Explorar o código

error zerowe drogi! todo bzyk

a.binder %!s(int64=9) %!d(string=hai) anos
pai
achega
e122245c61

+ 43 - 6
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"  /> <!-- set 1 to debug -->
     
     <xsl:output indent="yes"/>
     <xsl:strip-space elements="*"/>
@@ -64,6 +64,7 @@
                         <xsl:attribute name="Join_Y1" select="$Join_Y1"/>
                         <xsl:attribute name="Join_X2" select="$Join_X2"/>
                         <xsl:attribute name="Join_Y2" select="$Join_Y2"/>
+                            
                         <xsl:variable name="Ways">
                             <xsl:for-each select="$ways_asText_z_ID_xml/ways_asText_z_ID_xml/item[@ID_Way=$ID_Way]">
                                 <Way>
@@ -132,9 +133,10 @@
                                 </Way_next_cand>
                             </xsl:for-each>
                         </xsl:variable>
+                            <!-- todo nei wiem czy potrzebne to echo -->
                         <xsl:copy-of select="$Ways_J2_W2"/>
                         <!-- poszukamy czy Way_X2 wystepuje -->
-                    </Ways>
+                        </Ways>
                     </xsl:variable>
                     
                     <!--<xsl:variable name="Way_1_or_2">
@@ -228,7 +230,44 @@
             <xsl:attribute name="not_id" select="$not_id"/>
         </debug>-->
         <xsl:variable name="Linestring">
-            <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)) ]">
+            <!-- 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: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="$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"/>
@@ -246,8 +285,6 @@
                             </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">
@@ -268,7 +305,7 @@
                     </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))  ]">
+            <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"/>

+ 17 - 9
SE/dev/php-cli/edge_paths_with_PE_controll.xsl

@@ -18,10 +18,10 @@
     <xsl:param name="logic" select="'grouped'"/> <!-- tutaj robi grupy po $max_combinate_groups_elements -->
     <!--<xsl:param name="logic" select="'sorted'"/>--> <!-- tutaj robi grupy ale analizyje w grupie tylko wazniejsze/bardziej oblozone wezly -->
     
-    <xsl:param name="debug"/>
+    <xsl:param name="debug" select="1"/>
     
     
-    <xsl:param name="edge_paths_with_PE.xml"/>
+    <!--<xsl:param name="edge_paths_with_PE.xml"/>-->
     <xsl:param name="edge_paths_with_PE_controll_temp" select="'edge_paths_with_PE_controll_temp'"/> <!-- cache do przekazywani danych z petli-->
     <xsl:param name="edge_paths_with_PE_controll_temp.alias" select="'edge_paths_with_PE_controll_temp.alias'" />
     
@@ -95,9 +95,9 @@
             </xsl:message>
         <!--<xsl:variable name="edge_joins_filled_paths" select="collection( 'edge_joins_filled_paths?select=*.xml;recurse=yes')"/>-->
         
-        <!--<EdgeWayJoinsPair>
+        <EdgeWayJoinsPair>
             <xsl:copy-of select="$edge_joins_filled_path"></xsl:copy-of>
-        </EdgeWayJoinsPair>-->
+        </EdgeWayJoinsPair>
         
         <!-- liczmy najwieksza roznice odleglosci miedzy punktami -->
         
@@ -180,9 +180,9 @@
                     </xsl:for-each>
                 </EconomicDistanceCut2>
             </xsl:variable>
-            
-            <xsl:copy-of select="$EconomicDistanceCut"/>
-            
+            <debug_Cut2_183>
+            <xsl:copy-of select="$EconomicDistanceCut2"/>
+            </debug_Cut2_183>
             
             <xsl:variable name="EconomicDistanceCut2">
                 <EconomicDistanceCut2><xsl:attribute name="debug" select="'bez pustych punktow tylko grupowanie'"/>
@@ -338,12 +338,18 @@
                                     </xsl:variable>
                                     <odpalam_liczenie>
                                         <!-- todo dolozyc poprzedni wezel dodany aby mogl od niego zawsze liczyc -->
+                                        <!--<disabled>temporary blad after #410 OK - przeliczony wariant bit=000000010000 ( nr 4095;) 
+                                            [xslt] #239: calc @distanceGr=23; @point_count_Pos=19;@LineStringCount ; @len_sum=177; @distanceBeg=5055; @distanceEnd=5475;
+                                            [xslt]                         
+                                            [xslt] /Users/a.binder/Documents/biuro.biall-net.pl-gitlab-se-2015-02-16.git/SE/dev/php-cli/edge_paths_with_PE_controll.xsl:571: Fatal Error! Cannot convert string to double: ""
+                                            [xslt] Failed to process /Users/a.binder/Documents/biuro.biall-net.pl-gitlab-se-2015-02-16.git/SE/dev/php-cli/edge_joins_filled_paths.xml</disabled>-->
                                         <xsl:call-template name="calculate_optimum">
                                             <xsl:with-param name="candidates" select="$candidates"/>
                                             <xsl:with-param name="elements_cnt" select="count($candidates/bp:Path_Point)"/>
                                             <xsl:with-param name="max_bit" select="$max_bit"/>
                                             <xsl:with-param name="poprzednie_odpalam_liczenie_or_nie" select="$poprzednie_odpalam_liczenie_or_nie/poprzednie_odpalam_liczenie_or_nie"/>
                                         </xsl:call-template>
+                                        <debug352_cand><xsl:copy-of select="$candidates"></xsl:copy-of> </debug352_cand>
                                     </odpalam_liczenie>
                                 </xsl:when>
                                 <xsl:otherwise>
@@ -533,7 +539,7 @@
         <xsl:param name="poprzednie_odpalam_liczenie_or_nie"/>
         <xsl:param name="show_cables"/><!-- do ostatneigo wyzwolenia w koniec_wariantow aby pokazac skad dokad sa kable-->
         <xsl:variable name="candidates_merged_with_poprzednie">
-            <xsl:for-each select="$poprzednie_odpalam_liczenie_or_nie/*">
+            <xsl:for-each select="$poprzednie_odpalam_liczenie_or_nie/bp:Path_Point">
                 <bp:Path_Point>
                     <xsl:attribute name="poprzednia_grupa" select="true()"/>
                     <xsl:copy-of select="@*"/>
@@ -552,6 +558,8 @@
                     <poprzedniee><xsl:copy-of select="$poprzednie_odpalam_liczenie_or_nie/poprzednie_odpalam_liczenie_or_nie"/></poprzedniee>
                     <merged><xsl:copy-of select="$candidates_merged_with_poprzednie"/></merged>
                 </candidates_merged_with_poprzednie>
+            <xsl:message>calc_cost_way: calc <xsl:copy-of select="$candidates_merged_with_poprzednie//node()/@ID_Join"/></xsl:message>
+            
         </xsl:if>
         <xsl:for-each select="$candidates_merged_with_poprzednie/bp:Path_Point"> <!-- bylo cand_to_calc  -->
             <xsl:choose>
@@ -576,7 +584,7 @@
                     <xsl:variable name="way_dn_len">
                         <xsl:choose>
                             <xsl:when test="$way_dn_id">
-                                <xsl:value-of select="  number($candidates_merged_with_poprzednie/bp:Path_Point[@ID_Join=$way_dn_id]/@distance ) -  current()/@distance"/>
+                                <xsl:value-of select="  $candidates_merged_with_poprzednie/bp:Path_Point[@ID_Join=$way_dn_id]/number(@distance ) -  current()/@distance"/>
                             </xsl:when>
                             <xsl:otherwise><xsl:value-of select="-1"/></xsl:otherwise>
                         </xsl:choose>