فهرست منبع

poprawki TODO relacje drog i sprawdzic dalej kalinowa z WAY 214/1090

a.binder 9 سال پیش
والد
کامیت
ee1a80a8ca
2فایلهای تغییر یافته به همراه80 افزوده شده و 19 حذف شده
  1. 11 1
      SE/dev/php-cli/edge_joins_filled_paths_make.xsl
  2. 69 18
      SE/dev/php-cli/edge_paths_with_PE_controll.xsl

+ 11 - 1
SE/dev/php-cli/edge_joins_filled_paths_make.xsl

@@ -18,6 +18,7 @@
     <xsl:param name="joins2ways_z_ID_Way.xml" select="'joins2ways_z_ID_Way.xml'"/>
     <xsl:variable name="joins2ways_z_ID_Way" select="doc($joins2ways_z_ID_Way.xml)"/>
     
+    <xsl:param name="debug" /> <!-- set 1 to debug -->
     
     <xsl:output indent="yes"/>
     <xsl:strip-space elements="*"/>
@@ -133,7 +134,7 @@
                         <!-- poszukamy czy Way_X2 wystepuje -->
                     </Ways>
                     </xsl:variable>
-                    <!--<xsl:copy-of select="$Ways"/>-->
+                    
                     <!--<xsl:variable name="Way_1_or_2">
                     <xsl:choose>
                         <xsl:when test="$Ways/Ways/Way_next_cand[1]/@Way_X2">
@@ -169,6 +170,12 @@
                     <xsl:attribute name="len" select="$len"/>
                     <xsl:attribute name="Points_cnt" select="count($LineString/LineString/Points)"/>
                     <xsl:attribute name="Count" select=" count($LineString/LineString)"/>
+                    
+                    <xsl:if test="$debug">
+                        <debug_Ways>
+                            <xsl:copy-of select="$Ways"/>
+                        </debug_Ways>
+                    </xsl:if>
                     <!-- dodatkowo w xmlu aby bylo prosciej do przetwarzania -->
                     <!--<asText_XMl>
                             <xsl:copy-of select="$LineString"/>
@@ -225,12 +232,15 @@
                     <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">
                         <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 -->

+ 69 - 18
SE/dev/php-cli/edge_paths_with_PE_controll.xsl

@@ -14,7 +14,7 @@
     
     <xsl:param name="PE_Price" select="2500"/>
     <xsl:param name="Cable_Price" select="3"/>
-    <xsl:param name="max_combinate_groups_elements" select="14"/> <!-- po ile wezlow mamy grupowac do wyliczania kombinacji kosztow -->
+    <xsl:param name="max_combinate_groups_elements" select="10"/> <!-- po ile wezlow mamy grupowac do wyliczania kombinacji kosztow -->
     <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 -->
     
@@ -88,6 +88,7 @@
                         <distance>
                             <xsl:attribute name="pos" select="position()"/>
                             <xsl:attribute name="not_id" select="@not_id"/>
+                            <xsl:attribute name="ID_Join" select="@ID_Join"/>
                             <xsl:attribute name="len" select="@len"/>
                             <xsl:attribute name="id_path" select="@id_path"/>
                             <xsl:variable name="Points" select="count(Points)"/>
@@ -114,6 +115,7 @@
                     <xsl:for-each select="$EconomicDistanceCut/EconomicDistanceCut/distance">
                         <distance2>
                             <xsl:attribute name="distance" select="sum( $EconomicDistanceCut/EconomicDistanceCut/distance[number(@pos )&lt;  number(current()/@pos )]/@len)"/>
+                            <xsl:copy-of select="@ID_Join"/>
                             <!-- suma do poprzedniego pkt tylko dla tych co maja pkt-->
                             <xsl:choose>
                                 <xsl:when test="number(@point_count)&gt;0">
@@ -203,8 +205,10 @@
                     </distance2>
                 </xsl:for-each>
             </EconomicDistanceCut2>-->
-            <!--<xsl:copy-of select="$EconomicDistanceCut2"/>-->
-            
+            <!-- debug -->
+            <!--<debug>
+            <xsl:copy-of select="$EconomicDistanceCut2"/>
+            </debug>-->
             
             <xsl:variable name="elements_cnt" select="count($EconomicDistanceCut2/EconomicDistanceCut2/distance2[@point_count &gt; 0])"/><!-- liczba wezlow potencjalnych licbza PE-->
             <!--<xsl:variable name="bit_max" select="round($len  div  ( $PE_Price div $Cable_Price ) + count($EconomicDistanceCut2/EconomicDistanceCut2/distance2[@cost_dist &gt; $PE_Price])  )"/>--><!-- max licbza PE-->
@@ -270,6 +274,7 @@
                             <xsl:for-each select="distance2[ (  $logic='sorted' and ( ( position() &lt;= $bit_max_Pos and @point_count &gt;0 ) or (  position()=1 and $point_count_Pos &gt; 0 )  ) or position()= last()  )   or ( @point_count &gt;0 and $logic='grouped'  )  ]">  <!--@point_count &gt;0-->  <!--( position() &lt;= $bit_max_Pos and @point_count &gt;0 ) or (  position()=1 and $point_count_Pos &gt; 0 )  or position()= last() --> <!-- jak jest maly wspolczynnik to chociaz jeden punkt jak sa punkty jakies w tej grupie -->
                                     <xsl:sort select="@cost_dist" order="descending"/>
                                     <bp:Path_Point>
+                                        <xsl:copy-of select="@ID_Join"/>
                                         <xsl:attribute name="DebugPosPoint" select="position()"/>
                                         <xsl:attribute name="PosMatrGroup" select="@PosMatrGroup"/>
                                         <xsl:attribute name="distanceGr" select="$distanceGr"/>
@@ -439,6 +444,25 @@
                 <koniec_wariantow>
                     <xsl:message>#410 OK - przeliczony wariant bit=<xsl:value-of select="$best_variant"/> ( nr <xsl:value-of select="$variant"/>;) </xsl:message>
                     <xsl:attribute name="best_variant" select="$best_variant"/>
+                    <!-- trzeba przygotowac stary set dla best do pokazania kabli -->
+                    <xsl:variable name="cand_to_calc_best">
+                        <xsl:for-each select="$candidates/bp:Path_Point">
+                            <xsl:sort select="@distance"/>
+                            <bp:Path_Point>
+                                <!--<xsl:attribute name="bit" select="$bit"/>-->
+                                <xsl:attribute name="bin_pos"  select="substring($best_variant, position(),1)"/>
+                                <xsl:copy-of select="@*"/>
+                                <xsl:copy-of select="bp:Path_Point"></xsl:copy-of>
+                            </bp:Path_Point>
+                        </xsl:for-each>
+                    </xsl:variable>
+                    <xsl:variable name="show_cables">
+                        <xsl:call-template name="calc_cost_way">
+                            <xsl:with-param name="cand_to_calc" select="$cand_to_calc_best"/>
+                            <xsl:with-param name="poprzednie_odpalam_liczenie_or_nie" select="$poprzednie_odpalam_liczenie_or_nie"/>
+                            <xsl:with-param name="show_cables" select="1"/>
+                        </xsl:call-template>
+                    </xsl:variable>
                     <xsl:for-each select="$candidates/bp:Path_Point">
                     <xsl:sort select="@distance"/>
                     <xsl:if test="substring($best_variant, position(),1)='1'"><!-- jak wystawiony w wariancie-->
@@ -450,6 +474,22 @@
                             <xsl:copy-of select="bp:Path_Point"/>
                         </bp:Path_Point>
                     </xsl:if>
+                        <xsl:if test="substring($best_variant, position(),1)='0'"><!-- wyznaczenie od razu kabla -->
+                            <bp:Path_Point_Cable>
+                                <xsl:attribute name="bit" select="$best_variant"/>
+                                <xsl:attribute name="bin_pos"  select="substring($best_variant, position(),1)"/>
+                                <xsl:copy-of select="@*"/>
+                                <xsl:attribute name="Price" select="$best_cost"/>
+                                <xsl:attribute name="Target_ID_Join" select="$show_cables/cost[@ID_Join = current()/@ID_Join]/@Target_ID_Join"/>
+                                <!-- todo do jakiego Join zostal przybity -->
+                                <xsl:copy-of select="bp:Path_Point"/>
+                                    <!--<xsl:if test="$debug">
+                                    <debug_show_cables>
+                                        <xsl:copy-of select="$show_cables"></xsl:copy-of>
+                                    </debug_show_cables>
+                                    </xsl:if>-->
+                            </bp:Path_Point_Cable>
+                        </xsl:if>
                     </xsl:for-each>
                  </koniec_wariantow>
             </xsl:when>
@@ -470,7 +510,7 @@
     <xsl:template name="calc_cost_way"><!-- do wyliczenia ile wyjda kable w takiej konfiguracji -->
         <xsl:param name="cand_to_calc" required="yes"/>
         <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/*">
                 <bp:Path_Point>
@@ -503,19 +543,19 @@
                     </cost>
                 </xsl:when>
                 <xsl:when test="@bin_pos=0"><!-- szukamy gdzie ma najblizej i za ile -->
-                    <xsl:variable name="way_up_id" select="max($candidates_merged_with_poprzednie/bp:Path_Point[@bin_pos=1 and @id_path &lt;  current()/@id_path ]/number(@id_path))"/>
+                    <xsl:variable name="way_up_id" select="max($candidates_merged_with_poprzednie/bp:Path_Point[@bin_pos=1 and @id_path &lt;  current()/@id_path ]/number(@ID_Join))"/>
                     <xsl:variable name="way_up_len" >
                             <xsl:choose>
                                 <xsl:when test="$way_up_id">
-                                    <xsl:value-of select="number( current()/@distance) - number($candidates_merged_with_poprzednie/bp:Path_Point[@id_path=$way_up_id]/@distance)"/></xsl:when>
+                                    <xsl:value-of select="number( current()/@distance) - number($candidates_merged_with_poprzednie/bp:Path_Point[@ID_Join=$way_up_id]/@distance)"/></xsl:when>
                                 <xsl:otherwise><xsl:value-of select="-1"/></xsl:otherwise>
                             </xsl:choose>
                     </xsl:variable>
-                    <xsl:variable name="way_dn_id" select="max($candidates_merged_with_poprzednie/bp:Path_Point[@bin_pos=1 and @id_path &gt;  current()/@id_path ]/number(@id_path)) " />
+                    <xsl:variable name="way_dn_id" select="max($candidates_merged_with_poprzednie/bp:Path_Point[@bin_pos=1 and @id_path &gt;  current()/@id_path ]/number(@ID_Join)) " />
                     <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_path=$way_dn_id]/@distance ) -  current()/@distance"/>
+                                <xsl:value-of select="  number($candidates_merged_with_poprzednie/bp:Path_Point[@ID_Join=$way_dn_id]/@distance ) -  current()/@distance"/>
                             </xsl:when>
                             <xsl:otherwise><xsl:value-of select="-1"/></xsl:otherwise>
                         </xsl:choose>
@@ -534,12 +574,18 @@
                                     </xsl:choose>
                                 </xsl:variable>
                                  <!-- todo @point_count -->
-                                <xsl:attribute name="PE_Price" select="0"/>
-                                <xsl:attribute name="Cable_Price" select="$Cable_Price_sum"/>
+                                <xsl:if test="$show_cables">
+                                     <xsl:attribute name="choosed" select="'down'"/>
+                                     <xsl:attribute name="way_up_id" select="$way_up_id"/>
+                                     <xsl:attribute name="way_up_len" select="$way_up_len"/>
+                                     <xsl:attribute name="way_dn_id" select="$way_dn_id"/>
+                                     <xsl:attribute name="way_dn_len" select="$way_dn_len"/>
+                                     <xsl:attribute name="PE_Price" select="0"/>
+                                     <xsl:attribute name="Target_ID_Join" select="$way_dn_id"/>
+                                     <xsl:attribute name="ID_Join" select="@ID_Join"/>
+                                     <xsl:attribute name="Cable_Price" select="$Cable_Price_sum"/>
+                                </xsl:if>
                                 <xsl:attribute name="Price" select="$Cable_Price_sum"/>
-                                <xsl:attribute name="choosed" select="'down'"/>
-                                <xsl:attribute name="way_up_id" select="$way_up_id"/><xsl:attribute name="way_up_len" select="$way_up_len"/>
-                                <xsl:attribute name="way_dn_id" select="$way_dn_id"/><xsl:attribute name="way_dn_len" select="$way_dn_len"/>
                             </cost>
                         </xsl:when>
                         <xsl:otherwise>
@@ -554,12 +600,17 @@
                                         </xsl:otherwise>
                                     </xsl:choose>
                                 </xsl:variable>
-                                <xsl:attribute name="Cable_Price" select="$Cable_Price_sum"/> <!-- todo @point_count -->
-                                <xsl:attribute name="PE_Price" select="0"/>
+                                <xsl:if test="$show_cables">
+                                    <xsl:attribute name="Cable_Price" select="$Cable_Price_sum"/> <!-- todo @point_count -->
+                                    <xsl:attribute name="PE_Price" select="0"/>
+                                    <xsl:attribute name="choosed" select="'up'"/>
+                                    <xsl:attribute name="way_up_id" select="$way_up_id"/>
+                                    <xsl:attribute name="way_up_len" select="$way_up_len"/>
+                                    <xsl:attribute name="way_dn_len" select="$way_dn_len"/>
+                                    <xsl:attribute name="Target_ID_Join" select="$way_up_id"/>
+                                    <xsl:attribute name="ID_Join" select="@ID_Join"/>
+                                </xsl:if>
                                 <xsl:attribute name="Price" select="$Cable_Price_sum"/>
-                                <xsl:attribute name="choosed" select="'up'"/>
-                                <xsl:attribute name="way_up_id" select="$way_up_id"/><xsl:attribute name="way_up_len" select="$way_up_len"/>
-                                <xsl:attribute name="way_dn_id" select="$way_dn_id"/><xsl:attribute name="way_dn_len" select="$way_dn_len"/>
                             </cost>
                         </xsl:otherwise>
                     </xsl:choose>