Prechádzať zdrojové kódy

blad kilku drog po zerowej cdn

a.binder 9 rokov pred
rodič
commit
d1c7a0bcc3
1 zmenil súbory, kde vykonal 148 pridanie a 107 odobranie
  1. 148 107
      SE/dev/php-cli/edge_joins_filled_paths_make.xsl

+ 148 - 107
SE/dev/php-cli/edge_joins_filled_paths_make.xsl

@@ -20,7 +20,7 @@
     
     <xsl:param name="edge_joins_filled_paths" select="'edge_joins_filled_paths'"/> <!-- katalog do zapisywania sciezek -->
     
-    <xsl:param name="debug"  /> <!-- set 1 to debug -->
+    <xsl:param name="debug"  select="0" /> <!-- set 1 to debug -->
     
     <xsl:output indent="yes"/>
     <xsl:strip-space elements="*"/>
@@ -149,6 +149,7 @@
                     </xsl:variable>-->
                     <!--<Way_1_or_2><xsl:value-of select="$Way_1_or_2"/></Way_1_or_2>-->
                     <xsl:variable name="LineString">
+                        <xsl:message>#152 run templ PlaceWay for ID_Way=<xsl:value-of select="$ID_Way"/>;   </xsl:message>
                         <xsl:call-template name="PlaceWay">
                             <xsl:with-param name="Ways" select="$Ways"/>
                             <xsl:with-param name="Cur_X1" select="$Ways/Ways/@Join_X1"/>
@@ -200,9 +201,6 @@
                             <xsl:with-param name="LineString" select="$LineString"/>
                         </xsl:call-template>
                 </asText>
-            
-       
-            
         </item>
     </xsl:template>
     
@@ -216,7 +214,9 @@
         <xsl:param name="Last_Y2" required="yes"/>
         <xsl:param name="loop" select="1"/>
         <xsl:param name="not_id" required="no"/>
+        <xsl:param name="not_id_prev" required="no" select="-1"/>
         <xsl:param name="ID_Way" required="yes"/>
+        <xsl:if test="$debug"><xsl:message>###PlaceWay(Cur_X1=<xsl:value-of select="$Cur_X1"/>)###</xsl:message></xsl:if>
         <!--<LineString>
             <xsl:attribute name="X1" select="$Cur_X1"/>
             <xsl:attribute name="Y1" select="$Cur_Y1"/>
@@ -231,126 +231,166 @@
         </debug>-->
         <xsl:variable name="Linestring">
             <!-- jezeli sa zerowe drogi -->
-            <xsl:for-each select="$Ways/Ways/Way[ ( @Way_X1=$Cur_X1 and @Way_Y1=$Cur_Y1 or  @Way_X2=$Cur_X1 and @Way_Y2=$Cur_Y1 ) and ( not($not_id) or not(@id=$not_id))  and @Way_X1=@Way_X2 and @Way_Y1=@Way_Y2 ][1]">
-                <LineString>
-                    <xsl:attribute name="error" select="'zerowa droga!'"/>
-                    <xsl:attribute name="X" select="@Way_X2"/>
-                    <xsl:attribute name="Y" select="@Way_Y2"/>
-                    <xsl:attribute name="not_id" select="@id"/>
-                    <xsl:attribute name="len" select="@len"/>
-                    <xsl:variable name="X" select="@Way_X2"/>
-                    <xsl:variable name="Y" select="@Way_Y2"/>
-                    <xsl:for-each select="$ways2joins/ways2joins/item[@id= current()/@id]/item"> <!-- musi byc wczesniej bo atrybut sie nie doda drugi raz-->
-                        <xsl:for-each select="$joins_asText_xml/joins_asText_xml/item[@id= current()/text()]/bp:Path_Point">
-                            <xsl:if test="@X=$X and @Y=$Y">
-                                <xsl:variable name="ID_Join" select="parent::node()/@id"/>
-                                <xsl:attribute name="ID_Join" select="$ID_Join"/>
+            <xsl:choose>
+                <xsl:when test="$Ways/Ways/Way[ ( @Way_X1=$Cur_X1 and @Way_Y1=$Cur_Y1 or  @Way_X2=$Cur_X1 and @Way_Y2=$Cur_Y1 ) and ( not($not_id) or not(@id=$not_id))  and @Way_X1=@Way_X2 and @Way_Y1=@Way_Y2  and not(@id=$not_id_prev) ][1]">
+                    <xsl:for-each select="$Ways/Ways/Way[ ( @Way_X1=$Cur_X1 and @Way_Y1=$Cur_Y1 or  @Way_X2=$Cur_X1 and @Way_Y2=$Cur_Y1 ) and ( not($not_id) or not(@id=$not_id))  and @Way_X1=@Way_X2 and @Way_Y1=@Way_Y2  and not(@id=$not_id_prev) ][1]">
+                        <LineString>
+                            <xsl:attribute name="error" select="'zerowa droga!'"/>
+                            <xsl:attribute name="X" select="@Way_X2"/>
+                            <xsl:attribute name="Y" select="@Way_Y2"/>
+                            <xsl:attribute name="not_id" select="@id"/>
+                            <xsl:attribute name="len" select="@len"/>
+                            <xsl:if test="$debug">
+                                <xsl:message>Try to say @Way_X1:<xsl:value-of select="@Way_X1"/>; @Way_X2:<xsl:value-of select="@Way_X2"/>; $Cur_X1:<xsl:value-of select="$Cur_X1"/>; </xsl:message>
+                                <xsl:message>PlaceWay: 1=1;2=2  count()=<xsl:value-of select="count(.)"/>; lenX:<xsl:value-of select=" round(abs(number(@Way_X1) - number($Cur_X1)) * 1000)"/>; zerowa droga dla $Cur_X1=<xsl:value-of select="$Cur_X1"/>; $Cur_Y1=<xsl:value-of select="$Cur_Y1"/> @id=<xsl:value-of select="@id"/>; $not_id=<xsl:value-of select="$not_id"/>;</xsl:message>
                             </xsl:if>
-                        </xsl:for-each>
-                    </xsl:for-each>
-                    <xsl:for-each select="$ways2joins/ways2joins/item[@id= current()/@id]/item">
-                        <xsl:for-each select="$joins_asText_xml/joins_asText_xml/item[@id= current()/text()]/bp:Path_Point">
-                            <xsl:if test="@X=$X and @Y=$Y">
-                                <xsl:variable name="ID_Join" select="parent::node()/@id"/>
-                                <!--<xsl:attribute name="ID_Join" select="$ID_Join"/>-->
-                                <!-- punkty podpiete -->
-                                <xsl:copy-of select="$joins2ways_z_ID_Way/joins2ways_z_ID_Way/item[@id=$ID_Join]/Points"/>
-                                <!-- wyszukanie drog wychodzacych innych niz nasza z punktu -->
-                                <xsl:for-each select="$joins2ways_z_ID_Way/joins2ways_z_ID_Way/item[@id=$ID_Join]/item[not(@ID_WAY=$ID_Way)]">
-                                    <Ways>
-                                        <xsl:attribute name="ID_WAY" select="@ID_WAY"/>
-                                        <xsl:attribute name="ways_id" select="text()"/>
-                                    </Ways>
+                            <xsl:attribute name="not_id_prev" select="$not_id"/>
+                            <xsl:variable name="X" select="@Way_X2"/>
+                            <xsl:variable name="Y" select="@Way_Y2"/>
+                            <xsl:for-each select="$ways2joins/ways2joins/item[@id= current()/@id]/item"> <!-- musi byc wczesniej bo atrybut sie nie doda drugi raz-->
+                                <xsl:for-each select="$joins_asText_xml/joins_asText_xml/item[@id= current()/text()]/bp:Path_Point">
+                                    <xsl:if test="@X=$X and @Y=$Y">
+                                        <xsl:variable name="ID_Join" select="parent::node()/@id"/>
+                                        <xsl:attribute name="ID_Join" select="$ID_Join"/>
+                                    </xsl:if>
                                 </xsl:for-each>
-                            </xsl:if>
-                        </xsl:for-each>
-                    </xsl:for-each>
-                </LineString>
-            </xsl:for-each>
-            <xsl:for-each select="$Ways/Ways/Way[@Way_X1=$Cur_X1 and @Way_Y1=$Cur_Y1 and ( not($not_id) or not(@id=$not_id))  and not(@Way_X1=@Way_X2) and not(@Way_Y1=@Way_Y2) ]">
-                <LineString>
-                    <xsl:attribute name="X" select="@Way_X2"/>
-                    <xsl:attribute name="Y" select="@Way_Y2"/>
-                    <xsl:attribute name="not_id" select="@id"/>
-                    <xsl:attribute name="len" select="@len"/>
-                   
-                    <xsl:variable name="X" select="@Way_X2"/>
-                    <xsl:variable name="Y" select="@Way_Y2"/>
-                    
-                    <xsl:for-each select="$ways2joins/ways2joins/item[@id= current()/@id]/item"> <!-- musi byc wczesniej bo atrybut sie nie doda drugi raz-->
-                        <xsl:for-each select="$joins_asText_xml/joins_asText_xml/item[@id= current()/text()]/bp:Path_Point">
-                            <xsl:if test="@X=$X and @Y=$Y">
-                                <xsl:variable name="ID_Join" select="parent::node()/@id"/>
-                                    <xsl:attribute name="ID_Join" select="$ID_Join"/>
-                            </xsl:if>
-                        </xsl:for-each>
+                            </xsl:for-each>
+                            <xsl:for-each select="$ways2joins/ways2joins/item[@id= current()/@id]/item">
+                                <xsl:for-each select="$joins_asText_xml/joins_asText_xml/item[@id= current()/text()]/bp:Path_Point">
+                                    <xsl:if test="@X=$X and @Y=$Y">
+                                        <xsl:variable name="ID_Join" select="parent::node()/@id"/>
+                                        <!--<xsl:attribute name="ID_Join" select="$ID_Join"/>-->
+                                        <!-- punkty podpiete -->
+                                        <xsl:copy-of select="$joins2ways_z_ID_Way/joins2ways_z_ID_Way/item[@id=$ID_Join]/Points"/>
+                                        <!-- wyszukanie drog wychodzacych innych niz nasza z punktu -->
+                                        <xsl:for-each select="$joins2ways_z_ID_Way/joins2ways_z_ID_Way/item[@id=$ID_Join]/item[not(@ID_WAY=$ID_Way)]">
+                                            <Ways>
+                                                <xsl:attribute name="ID_WAY" select="@ID_WAY"/>
+                                                <xsl:attribute name="ways_id" select="text()"/>
+                                            </Ways>
+                                        </xsl:for-each>
+                                    </xsl:if>
+                                </xsl:for-each>
+                            </xsl:for-each>
+                        </LineString>
                     </xsl:for-each>
-                    <xsl:for-each select="$ways2joins/ways2joins/item[@id= current()/@id]/item">
-                        <xsl:for-each select="$joins_asText_xml/joins_asText_xml/item[@id= current()/text()]/bp:Path_Point">
-                            <xsl:if test="@X=$X and @Y=$Y">
-                                
-                                <xsl:variable name="ID_Join" select="parent::node()/@id"/>
-                                <!--<xsl:attribute name="ID_Join" select="$ID_Join"/>-->
-                                <!-- punkty podpiete -->
-                                <xsl:copy-of select="$joins2ways_z_ID_Way/joins2ways_z_ID_Way/item[@id=$ID_Join]/Points"/>
-                                <!-- wyszukanie drog wychodzacych innych niz nasza z punktu -->
-                                <xsl:for-each select="$joins2ways_z_ID_Way/joins2ways_z_ID_Way/item[@id=$ID_Join]/item[not(@ID_WAY=$ID_Way)]">
-                                    <Ways>
-                                        <xsl:attribute name="ID_WAY" select="@ID_WAY"/>
-                                        <xsl:attribute name="ways_id" select="text()"/>
-                                    </Ways>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:for-each select="$Ways/Ways/Way[@Way_X1=$Cur_X1 and @Way_Y1=$Cur_Y1 and ( not($not_id) or not(@id=$not_id))  and not(@Way_X1=@Way_X2) and not(@Way_Y1=@Way_Y2) and not(@id=$not_id_prev) ]">
+                        <LineString>
+                            <xsl:attribute name="X" select="@Way_X2"/>
+                            <xsl:attribute name="Y" select="@Way_Y2"/>
+                            <xsl:attribute name="not_id" select="@id"/>
+                            <xsl:attribute name="len" select="@len"/>
+                            <xsl:attribute name="not_id_prev" select="$not_id"/>
+                            <xsl:variable name="X" select="@Way_X2"/>
+                            <xsl:variable name="Y" select="@Way_Y2"/>
+                            
+                            <xsl:choose>
+                                <xsl:when test="number(count(@Way_X2)) &gt; number(1)"><xsl:message>#282 error count&gt; of @Way_X2<xsl:value-of select="@Way_X2"/> </xsl:message></xsl:when>
+                                <xsl:otherwise>
+                                    <!--<xsl:if test=" abs(number(@Way_X2) - number($Cur_X1)) &gt; 0.001 ">
+                                 <xsl:message>#326 too long way <xsl:value-of select="abs(number(@Way_X2) - number($Cur_X1))"/></xsl:message>
+                            </xsl:if>-->
+                                    <xsl:if test="$debug">
+                                        <xsl:message>Try to say @Way_X1:<xsl:value-of select="@Way_X1"/>; @Way_X2:<xsl:value-of select="@Way_X2"/>; $Cur_X1:<xsl:value-of select="$Cur_X1"/>; </xsl:message>
+                                        <xsl:message>PlaceWay:  1=1 count()=<xsl:value-of select="count(.)"/>; number(@Way_X2)<xsl:value-of select="@Way_X2"/>  lenX:<xsl:value-of select=" round(number(@Way_X2) - number($Cur_X1) * 100) "/>; dla $Cur_X1=<xsl:value-of select="$Cur_X1"/>; $Cur_Y1=<xsl:value-of select="$Cur_Y1"/> @id=<xsl:value-of select="@id"/>; $not_id=<xsl:value-of select="$not_id"/>;</xsl:message>
+                                    </xsl:if>
+                                </xsl:otherwise>
+                            </xsl:choose>
+                            
+                            
+                            <xsl:for-each select="$ways2joins/ways2joins/item[@id= current()/@id]/item"> <!-- musi byc wczesniej bo atrybut sie nie doda drugi raz-->
+                                <xsl:for-each select="$joins_asText_xml/joins_asText_xml/item[@id= current()/text()]/bp:Path_Point">
+                                    <xsl:if test="@X=$X and @Y=$Y">
+                                        <xsl:variable name="ID_Join" select="parent::node()/@id"/>
+                                        <xsl:attribute name="ID_Join" select="$ID_Join"/>
+                                    </xsl:if>
                                 </xsl:for-each>
-                            </xsl:if>
-                        </xsl:for-each>
+                            </xsl:for-each>
+                            <xsl:for-each select="$ways2joins/ways2joins/item[@id= current()/@id]/item">
+                                <xsl:for-each select="$joins_asText_xml/joins_asText_xml/item[@id= current()/text()]/bp:Path_Point">
+                                    <xsl:if test="@X=$X and @Y=$Y">
+                                        <xsl:variable name="ID_Join" select="parent::node()/@id"/>
+                                        <!--<xsl:attribute name="ID_Join" select="$ID_Join"/>-->
+                                        <!-- punkty podpiete -->
+                                        <xsl:copy-of select="$joins2ways_z_ID_Way/joins2ways_z_ID_Way/item[@id=$ID_Join]/Points"/>
+                                        <!-- wyszukanie drog wychodzacych innych niz nasza z punktu -->
+                                        <xsl:for-each select="$joins2ways_z_ID_Way/joins2ways_z_ID_Way/item[@id=$ID_Join]/item[not(@ID_WAY=$ID_Way)]">
+                                            <Ways>
+                                                <xsl:attribute name="ID_WAY" select="@ID_WAY"/>
+                                                <xsl:attribute name="ways_id" select="text()"/>
+                                            </Ways>
+                                        </xsl:for-each>
+                                    </xsl:if>
+                                </xsl:for-each>
+                            </xsl:for-each>
+                        </LineString>
                     </xsl:for-each>
-                </LineString>
-            </xsl:for-each>
-            <xsl:for-each select="$Ways/Ways/Way[@Way_X2=$Cur_X1 and @Way_Y2=$Cur_Y1 and ( not($not_id) or not(@id=$not_id))  and not(@Way_X1=@Way_X2) and not(@Way_Y1=@Way_Y2) ]">
-                <LineString>
-                    <xsl:attribute name="X" select="@Way_X1"/>
-                    <xsl:attribute name="Y" select="@Way_Y1"/>
-                    <xsl:attribute name="not_id" select="@id"/>
-                    <xsl:attribute name="len" select="@len"/>
-                    <xsl:variable name="X" select="@Way_X1"/>
-                    <xsl:variable name="Y" select="@Way_Y1"/>
-                    
-                    <xsl:for-each select="$ways2joins/ways2joins/item[@id= current()/@id]/item"> <!-- musi byc wczesniej bo atrybut sie nie doda drugi raz-->
-                        <xsl:for-each select="$joins_asText_xml/joins_asText_xml/item[@id= current()/text()]/bp:Path_Point">
-                            <xsl:if test="@X=$X and @Y=$Y">
-                                <xsl:variable name="ID_Join" select="parent::node()/@id"/>
-                                <xsl:attribute name="ID_Join" select="$ID_Join"/>
+                    <xsl:for-each select="$Ways/Ways/Way[@Way_X2=$Cur_X1 and @Way_Y2=$Cur_Y1 and ( not($not_id) or not(@id=$not_id))  and not(@Way_X1=@Way_X2) and not(@Way_Y1=@Way_Y2) and not(@id=$not_id_prev) ]">
+                        <LineString>
+                            <xsl:attribute name="X" select="@Way_X1"/>
+                            <xsl:attribute name="Y" select="@Way_Y1"/>
+                            <xsl:attribute name="not_id" select="@id"/>
+                            <xsl:attribute name="len" select="@len"/>
+                            <xsl:attribute name="not_id_prev" select="$not_id"/>
+                            <xsl:variable name="X" select="@Way_X1"/>
+                            <xsl:variable name="Y" select="@Way_Y1"/>
+                            <xsl:if test="$debug">
+                                <xsl:message>PlaceWay: 1=2 count()=<xsl:value-of select="count(.)"/>; lenX:<xsl:value-of select=" round(number(@Way_X1) - number($Cur_X1) * 100)"/>; dla $Cur_X1=<xsl:value-of select="$Cur_X1"/>; $Cur_Y1=<xsl:value-of select="$Cur_Y1"/> @id=<xsl:value-of select="@id"/>; $not_id=<xsl:value-of select="$not_id"/>;</xsl:message>
                             </xsl:if>
-                        </xsl:for-each>
-                    </xsl:for-each>
-                    
-                    <xsl:for-each select="$ways2joins/ways2joins/item[@id= current()/@id]/item">
-                        <xsl:for-each select="$joins_asText_xml/joins_asText_xml/item[@id= current()/text()]/bp:Path_Point">
-                            <xsl:if test="@X=$X and @Y=$Y">
-                                <xsl:variable name="ID_Join" select="parent::node()/@id"/>
-                                <!-- punkty podpiete -->
-                                <xsl:copy-of select="$joins2ways_z_ID_Way/joins2ways_z_ID_Way/item[@id=$ID_Join]/Points"/>
-                                <!-- wyszukanie drog wychodzacych innych niz nasza z punktu -->
-                                <xsl:for-each select="$joins2ways_z_ID_Way/joins2ways_z_ID_Way/item[@id=$ID_Join]/item[not(@ID_WAY=$ID_Way)]">
-                                    <Ways>
-                                        <xsl:attribute name="ID_WAY" select="@ID_WAY"/>
-                                        <xsl:attribute name="ways_id" select="text()"/>
-                                    </Ways>
-                                </xsl:for-each>
+                            <xsl:if test=" abs(number(@Way_X1) - number($Cur_X1)) &gt; 0.001 ">
+                                <xsl:message>#326 too long way <xsl:value-of select="abs(number(@Way_X1) - number($Cur_X1))"/></xsl:message>
                             </xsl:if>
-                        </xsl:for-each>
+                            <xsl:for-each select="$ways2joins/ways2joins/item[@id= current()/@id]/item"> <!-- musi byc wczesniej bo atrybut sie nie doda drugi raz-->
+                                <xsl:for-each select="$joins_asText_xml/joins_asText_xml/item[@id= current()/text()]/bp:Path_Point">
+                                    <xsl:if test="@X=$X and @Y=$Y">
+                                        <xsl:variable name="ID_Join" select="parent::node()/@id"/>
+                                        <xsl:attribute name="ID_Join" select="$ID_Join"/>
+                                    </xsl:if>
+                                </xsl:for-each>
+                            </xsl:for-each>
+                            
+                            <xsl:for-each select="$ways2joins/ways2joins/item[@id= current()/@id]/item">
+                                <xsl:for-each select="$joins_asText_xml/joins_asText_xml/item[@id= current()/text()]/bp:Path_Point">
+                                    <xsl:if test="@X=$X and @Y=$Y">
+                                        <xsl:variable name="ID_Join" select="parent::node()/@id"/>
+                                        <!-- punkty podpiete -->
+                                        <xsl:copy-of select="$joins2ways_z_ID_Way/joins2ways_z_ID_Way/item[@id=$ID_Join]/Points"/>
+                                        <!-- wyszukanie drog wychodzacych innych niz nasza z punktu -->
+                                        <xsl:for-each select="$joins2ways_z_ID_Way/joins2ways_z_ID_Way/item[@id=$ID_Join]/item[not(@ID_WAY=$ID_Way)]">
+                                            <Ways>
+                                                <xsl:attribute name="ID_WAY" select="@ID_WAY"/>
+                                                <xsl:attribute name="ways_id" select="text()"/>
+                                            </Ways>
+                                        </xsl:for-each>
+                                    </xsl:if>
+                                </xsl:for-each>
+                            </xsl:for-each>
+                        </LineString>
                     </xsl:for-each>
-                </LineString>
-            </xsl:for-each>
+                </xsl:otherwise>
+            </xsl:choose>
+            
+            
         </xsl:variable>
         <xsl:copy-of select="$Linestring"/>
         <xsl:choose>
             <xsl:when test="$loop &gt; 100000">
-                <loop_limit/>
+                <loop_limit>
+                    <xsl:message terminate="yes">
+                        Loop limit dla PlaceWay: 1=2  dla $Cur_X1=<xsl:value-of select="$Cur_X1"/>; $Cur_Y1=<xsl:value-of select="$Cur_Y1"/> @id=<xsl:value-of select="@id"/>; $not_id=<xsl:value-of select="$not_id"/>
+                    </xsl:message>
+                </loop_limit>
+                
             </xsl:when>
             <xsl:when test="$Linestring/LineString/@X = $Last_X2 and $Linestring/LineString/@Y = $Last_Y2 ">
                 <ostatni/>
             </xsl:when>
             <xsl:otherwise>
+                <xsl:if test="$debug">
+                    <xsl:message>call-templ with Cur_X1=<xsl:value-of select="$Linestring/LineString/@X"/>; not_id=<xsl:value-of select="$Linestring/LineString/@not_id"/>;  not_id_prev=<xsl:value-of select="$Linestring/LineString/@not_id_prev"/></xsl:message>
+                </xsl:if>
                 <xsl:call-template name="PlaceWay">
                     <xsl:with-param name="Ways" select="$Ways"/>
                     <xsl:with-param name="Cur_X1" select="$Linestring/LineString/@X"/>
@@ -358,6 +398,7 @@
                     <xsl:with-param name="Last_X2" select="$Last_X2"/>
                     <xsl:with-param name="Last_Y2" select="$Last_Y2"/>
                     <xsl:with-param name="not_id" select="$Linestring/LineString/@not_id"/>
+                    <xsl:with-param name="not_id_prev" select="$Linestring/LineString/@not_id_prev"></xsl:with-param>
                     <xsl:with-param name="loop" select="$loop+1"/>
                     <xsl:with-param name="ID_Way" select="$ID_Way"/>
                 </xsl:call-template>