فهرست منبع

przetworzenie wspolrzednych

a.binder 9 سال پیش
والد
کامیت
ef258e0dda

+ 30 - 0
SE/dev/php-cli/asText.xsl

@@ -34,4 +34,34 @@
             </bp:Path_Point>
             </bp:Path_Point>
         </xsl:for-each>
         </xsl:for-each>
     </xsl:template>
     </xsl:template>
+    
+    
+    <xsl:template match="asText" mode="POINT">
+        <xsl:variable name="LINESTRING" select=" substring-before( substring-after(normalize-space(.),'POINT (') , ')')  "/>
+        <!--<test1><xsl:copy-of select="$LINESTRING"/></test1>-->
+        <xsl:for-each select="tokenize($LINESTRING,',')">
+            <bp:Path_Point>
+                <!--<xsl:attribute name="test2" select="."/>-->
+                <xsl:variable name="pos">
+                    <xsl:for-each select="tokenize(.,' ')">
+                        <pos>
+                            <xsl:attribute name="pos" select="position()"/>
+                            <xsl:value-of select="."/>
+                        </pos>
+                    </xsl:for-each>
+                </xsl:variable>
+                <xsl:choose>
+                    <xsl:when test="string-length($pos/pos[@pos=1]/text())&gt;0">
+                        <xsl:attribute name="X" select="$pos/pos[@pos=1]"/>
+                        <xsl:attribute name="Y" select="$pos/pos[@pos=2]"/>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:attribute name="X" select="$pos/pos[@pos=2]"/>
+                        <xsl:attribute name="Y" select="$pos/pos[@pos=3]"/>
+                    </xsl:otherwise>
+                </xsl:choose>
+                <!--<test3><xsl:copy-of select="$pos"/></test3>-->
+            </bp:Path_Point>
+        </xsl:for-each>
+    </xsl:template>
 </xsl:stylesheet>
 </xsl:stylesheet>

+ 62 - 0
SE/dev/php-cli/edge_joins_filled_paths_make.xsl

@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:bp="https://procesy5.pl/biale_plamy-schema.xsd"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    
+    <xsl:param name="ways_as_Text_z_ID_xml.xml" select="'ways_as_Text_z_ID_xml.xml'"/>
+    <xsl:variable name="ways_asText_z_ID_xml" select="doc($ways_as_Text_z_ID_xml.xml)"/>
+    
+    <xsl:param name="joins_asText_xml.xml" select="'joins_asText_xml.xml'"/>
+    <xsl:variable name="joins_asText_xml" select="doc($joins_asText_xml.xml)"/>
+    
+    
+    <xsl:output indent="yes"/>
+    <xsl:strip-space elements="*"/>
+    
+    <xsl:template match="EdgeWayJoins">
+        <edge_joins_filled_paths>
+            <xsl:attribute name="stylesheet" select="'edge_joins_filled_paths_make.xsl'"/>
+        <xsl:apply-templates/>
+        </edge_joins_filled_paths>
+    </xsl:template>
+    
+    
+    <xsl:template match="EdgeWayJoinsPair">
+        <item>
+            <xsl:attribute name="id" select="@ID_Way"/>
+            <xsl:variable name="ID_Way" select="@ID_Way"/>
+            <asText>
+                <xsl:variable name="bp:Joins">
+                <xsl:for-each select="bp:Joins">
+                    <bp:Joins>
+                        <xsl:copy-of select="@*"/>
+                        <xsl:copy-of select="$joins_asText_xml/joins_asText_xml/item[@id= current()/@id]/bp:Path_Point/@X"/>
+                        <xsl:copy-of select="$joins_asText_xml/joins_asText_xml/item[@id= current()/@id]/bp:Path_Point/@Y"/>
+                        <xsl:attribute name="position" select="position()"/>
+                    </bp:Joins>
+                </xsl:for-each>
+                </xsl:variable>
+                <xsl:variable name="Join_X1" select="$bp:Joins/bp:Joins[@position=1]/@X"/>
+                <xsl:variable name="Join_Y1" select="$bp:Joins/bp:Joins[@position=1]/@Y"/>
+                <xsl:variable name="Join_X2" select="$bp:Joins/bp:Joins[@position=2]/@X"/>
+                <xsl:variable name="Join_Y2" select="$bp:Joins/bp:Joins[@position=2]/@Y"/>
+                <!-- na podstawie joina ustalamy jego wspolrzedne -->
+                
+                <!-- teraz trzeba wiedziec ktory punkt wziac z drogi - czy pierwszy czy drugi jaki pasuje do pary -->
+                <Ways>
+                    <xsl:for-each select="$ways_asText_z_ID_xml/ways_asText_z_ID_xml/item[@ID_Way=$ID_Way]/bp:Path_Point">
+                        <bp:Path_Point>
+                            <xsl:copy-of select="@*"/>
+                        </bp:Path_Point>
+                </xsl:for-each> 
+                </Ways>
+            </asText>
+        </item>
+    </xsl:template>
+    
+    
+    
+    
+</xsl:stylesheet>

+ 33 - 0
SE/dev/php-cli/joins_asText_xml.xsl

@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:bp="https://procesy5.pl/biale_plamy-schema.xsd"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    
+    <xsl:import href="asText.xsl"/>
+    <xsl:output indent="yes"/>
+    <xsl:strip-space elements="*"/>
+    
+    <xsl:template match="joins_asText">
+        <joins_asText_xml>
+            <xsl:apply-templates/>
+        </joins_asText_xml>    
+    </xsl:template>
+    
+    
+    <xsl:template match="item">
+        <item>
+            <xsl:copy-of select="@id"/>
+            <xsl:variable name="asText">
+                <asText>
+                    <xsl:value-of select="text()"/>
+                </asText>
+            </xsl:variable>
+            <xsl:apply-templates mode="POINT" select="$asText"/>
+        </item>
+        
+    </xsl:template>
+    
+    
+</xsl:stylesheet>

+ 1 - 0
SE/dev/php-cli/ways_as_Text_z_ID_xml.xsl

@@ -22,6 +22,7 @@
     <xsl:template match="item">
     <xsl:template match="item">
         <item>
         <item>
         <xsl:copy-of select="@*"/>
         <xsl:copy-of select="@*"/>
+            <xsl:attribute name="pos" select="position()"/>
             <xsl:attribute name="ID_Way" select="$ways2drogi/ways2drogi/item[@id= current()/@id]/text()"/>
             <xsl:attribute name="ID_Way" select="$ways2drogi/ways2drogi/item[@id= current()/@id]/text()"/>
         <xsl:apply-templates/>
         <xsl:apply-templates/>
         </item>
         </item>