Ver código fonte

poprawaedges

a.binder 9 anos atrás
pai
commit
e06d6a124a

+ 89 - 2
SE/dev/php-cli/biale_plamy_joins2ways_do_paths.xsl

@@ -40,6 +40,25 @@
             </xsl:otherwise>
             </xsl:otherwise>
         </xsl:choose>-->
         </xsl:choose>-->
         <!--<xsl:copy-of select="$EdgeWayJoinsPair_cand/no_EdgeWayJoinsPair"></xsl:copy-of>-->
         <!--<xsl:copy-of select="$EdgeWayJoinsPair_cand/no_EdgeWayJoinsPair"></xsl:copy-of>-->
+        <xsl:variable name="guess_edges">
+            
+                <xsl:for-each select="item">
+                    <guess_join>
+                        <xsl:attribute name="ID_Way" select="@ID_Way"/>
+                        <xsl:variable name="ID_Way">
+                            <xsl:choose>
+                                <xsl:when test="@ID_Way"><xsl:value-of select="@ID_Way"/></xsl:when>
+                                <xsl:otherwise><xsl:value-of select="0"/></xsl:otherwise>
+                            </xsl:choose>
+                        </xsl:variable>
+                        <xsl:apply-templates select="." mode="joins_not_way">
+                            <xsl:with-param name="ID_Way" select="$ID_Way"/>
+                        </xsl:apply-templates>
+                    </guess_join>
+                </xsl:for-each>
+               
+            
+        </xsl:variable>
         
         
         <EdgeWayJoins>
         <EdgeWayJoins>
             <!--<xsl:for-each-group select="$EdgeWayJoinsPair_cand/no_EdgeWayJoinsPair" group-by="@ID_Way">
             <!--<xsl:for-each-group select="$EdgeWayJoinsPair_cand/no_EdgeWayJoinsPair" group-by="@ID_Way">
@@ -87,11 +106,14 @@
                 </EdgeWayJoinsPair>
                 </EdgeWayJoinsPair>
             </xsl:for-each-group>-->
             </xsl:for-each-group>-->
             <xsl:for-each-group select="item" group-by="@ID_Way">
             <xsl:for-each-group select="item" group-by="@ID_Way">
+                <xsl:variable name="ID_Way" select="@ID_Way"/>
+                
                 <EdgeWayJoinsPair>
                 <EdgeWayJoinsPair>
                     <xsl:attribute name="ID_Way" select="@ID_Way"/>
                     <xsl:attribute name="ID_Way" select="@ID_Way"/>
-                    <xsl:variable name="ID_Way" select="@ID_Way"/>
+                    <!--<xsl:copy-of select="$guess_edges/guess_join[@ID_Way=$ID_Way]"></xsl:copy-of>-->
                     <xsl:for-each select="current-group()">
                     <xsl:for-each select="current-group()">
-                            <xsl:choose>
+                        <!--<GROUP><xsl:copy-of select="item("></xsl:copy-of></GROUP>-->
+                        <xsl:choose>
                                 <xsl:when test=" position()=1 or position()=last()">
                                 <xsl:when test=" position()=1 or position()=last()">
                                     <bp:Joins>
                                     <bp:Joins>
                                         <xsl:attribute name="Joins" select="@id"/>
                                         <xsl:attribute name="Joins" select="@id"/>
@@ -163,6 +185,71 @@
         
         
     </xsl:template>
     </xsl:template>
     
     
+    <xsl:template match="item" mode="joins_not_way">
+        <xsl:param name="ID_Way" required="yes"/>
+        <!--<xsl:variable name="count_our_way">
+            <xsl:for-each select="item">
+                <xsl:element name="count_our_way">
+                    <xsl:choose>
+                        <xsl:when test="@ID_WAY=$ID_Way">1</xsl:when>
+                        <xsl:otherwise>0</xsl:otherwise>
+                    </xsl:choose>
+                </xsl:element>
+            </xsl:for-each>
+        </xsl:variable>-->
+          <!--<see>
+                <xsl:copy-of select="."/>
+              <inside>   
+                  <xsl:attribute name="count_our"   select="count(item[@ID_WAY=$ID_Way])"/>
+                  <count_our_way_val>
+                  <xsl:copy-of select="$count_our_way"/>
+                  </count_our_way_val>
+                <xsl:for-each select="item[@ID_WAY!=$ID_Way]">
+                  <xsl:element name="EdgeWayJoinsPair_cand">
+                      <xsl:attribute name="joins" select="../@id"/>
+                      <xsl:attribute name="ID_Way" select="../@ID_Way"/>
+                  </xsl:element>  
+              </xsl:for-each>
+              </inside>
+        </see>-->
+        <xsl:variable name="if_item_not_in_way">
+            <xsl:for-each select="item">
+                <xsl:choose>
+                    <xsl:when test="not(@ID_WAY=$ID_Way)">
+                        <xsl:element name="EdgeWayJoinsPair_cand">
+                        <xsl:attribute name="joins" select="../@id"/>
+                        <xsl:attribute name="ID_Way" select="../@ID_Way"/>
+                    </xsl:element></xsl:when>
+                </xsl:choose>
+                
+                
+            </xsl:for-each>
+        </xsl:variable>
+        <xsl:choose>
+            <xsl:when test="count(item)=1">
+                <xsl:element name="EdgeWayJoinsPair_cand">
+                    <xsl:attribute name="pos" select="position()"/>
+                    <xsl:attribute name="joins" select="@id"/>
+                    <xsl:attribute name="ID_Way" select="@ID_Way"/>
+                    <xsl:attribute name="ways" select="item/text()"/>
+                </xsl:element>
+            </xsl:when>
+            <xsl:when test="$if_item_not_in_way/EdgeWayJoinsPair_cand and count(item[@ID_WAY=$ID_Way])&lt;2">
+                <xsl:element name="EdgeWayJoinsPair_cand">
+                    <xsl:attribute name="debug" select="'has other way'"/>
+                    <xsl:attribute name="joins" select="@id"/>
+                    <xsl:attribute name="ID_Way" select="@ID_Way"/>
+                    <xsl:attribute name="ways">
+                        <xsl:for-each select="item/text()">
+                            <xsl:value-of select=" concat(.,' ')"/> 
+                        </xsl:for-each>
+                    </xsl:attribute>
+                    <!--<xsl:attribute name="ways" select="item/text()" separator="', '" />-->
+                </xsl:element>
+            </xsl:when>
+        </xsl:choose>
+    </xsl:template>
+    
     <xsl:template match="item" mode="joins">
     <xsl:template match="item" mode="joins">
         <!--<xsl:param name="second_turn" />-->
         <!--<xsl:param name="second_turn" />-->
         <xsl:choose>
         <xsl:choose>

+ 8 - 1
SE/dev/php-cli/joins2ways_z_ID_Way.xsl

@@ -11,7 +11,14 @@
     
     
     <xsl:template match="joins2ways">
     <xsl:template match="joins2ways">
         <joins2ways_z_ID_Way>
         <joins2ways_z_ID_Way>
-            <xsl:apply-templates/>
+            <xsl:variable name="joins2ways">
+                <xsl:apply-templates>
+                </xsl:apply-templates>
+            </xsl:variable>
+            <xsl:for-each select="$joins2ways/item">
+                <xsl:sort select="number(@ID_Way)"/>
+                <xsl:copy-of select="."/>
+            </xsl:for-each>
         </joins2ways_z_ID_Way>
         </joins2ways_z_ID_Way>
     </xsl:template>
     </xsl:template>
     <xsl:template match="item">
     <xsl:template match="item">