a.binder 9 years ago
parent
commit
cab2252bad
1 changed files with 41 additions and 17 deletions
  1. 41 17
      SE/dev/php-cli/edge_paths_with_PE_controll.xsl

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

@@ -51,11 +51,10 @@
         </PE_candidates_dump>
         </PE_candidates_dump>
     </xsl:template>
     </xsl:template>
     
     
-    
     <xsl:template match="Path" mode="edge_paths_with_PE.xml">
     <xsl:template match="Path" mode="edge_paths_with_PE.xml">
         <LINESTRING>
         <LINESTRING>
             <xsl:attribute name="ID_Way" select="@id"/>
             <xsl:attribute name="ID_Way" select="@id"/>
-            <xsl:attribute name="Count"  select="''"/>
+            <xsl:attribute name="Count"  select="@Count"/>
             <xsl:attribute name="ID_Point_count" select="@Points_cnt"/>
             <xsl:attribute name="ID_Point_count" select="@Points_cnt"/>
             <xsl:attribute name="distance"/>
             <xsl:attribute name="distance"/>
             <xsl:attribute name="dumb_frequency" select="''"/>
             <xsl:attribute name="dumb_frequency" select="''"/>
@@ -63,7 +62,15 @@
         </LINESTRING>
         </LINESTRING>
     </xsl:template>
     </xsl:template>
     
     
+    <xsl:template match="PointMatrixGroupPE" mode="edge_paths_with_PE.xml">
+        
+        <xsl:apply-templates mode="edge_paths_with_PE.xml"/>
+    </xsl:template>
     
     
+    <xsl:template match="PointMatrixGroup" mode="edge_paths_with_PE.xml">
+        <!--<test_matrux><xsl:copy-of select="."></xsl:copy-of></test_matrux>-->
+        <xsl:apply-templates mode="edge_paths_with_PE.xml"/>
+    </xsl:template>
     
     
     <xsl:template match="bp:Path_Point" mode="edge_paths_with_PE.xml">
     <xsl:template match="bp:Path_Point" mode="edge_paths_with_PE.xml">
         <xsl:copy-of select="."/>
         <xsl:copy-of select="."/>
@@ -80,9 +87,9 @@
             <xsl:variable name="len" select="@len"/>
             <xsl:variable name="len" select="@len"/>
         <!--<xsl:variable name="edge_joins_filled_paths" select="collection( 'edge_joins_filled_paths?select=*.xml;recurse=yes')"/>-->
         <!--<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>
             <xsl:copy-of select="$edge_joins_filled_path"></xsl:copy-of>
-        </EdgeWayJoinsPair>
+        </EdgeWayJoinsPair>-->
         
         
         <!-- liczmy najwieksza roznice odleglosci miedzy punktami -->
         <!-- liczmy najwieksza roznice odleglosci miedzy punktami -->
         
         
@@ -128,7 +135,7 @@
                                     <xsl:attribute name="disttopkt" select="$disttopkt" />
                                     <xsl:attribute name="disttopkt" select="$disttopkt" />
                                     <xsl:variable name="cost_dist" select="$Cable_Price * $disttopkt * @point_count"/>
                                     <xsl:variable name="cost_dist" select="$Cable_Price * $disttopkt * @point_count"/>
                                     <xsl:attribute name="cost_dist" select="$cost_dist"/>
                                     <xsl:attribute name="cost_dist" select="$cost_dist"/>
-                                    
+                                    <xsl:attribute name="point_count" select="@point_count"/>
                                     <xsl:if test="$cost_dist &gt; $PE_Price">
                                     <xsl:if test="$cost_dist &gt; $PE_Price">
                                         <xsl:attribute name="cut_by_pe" select="1"/>
                                         <xsl:attribute name="cut_by_pe" select="1"/>
                                     </xsl:if>
                                     </xsl:if>
@@ -144,7 +151,7 @@
                 </EconomicDistanceCut2>
                 </EconomicDistanceCut2>
             </xsl:variable>
             </xsl:variable>
             
             
-            <!--<xsl:copy-of select="$EconomicDistanceCut2"/>-->
+            <xsl:copy-of select="$EconomicDistanceCut2"/>
             
             
             <xsl:variable name="elements_cnt" select="count($EconomicDistanceCut2/EconomicDistanceCut2/distance2[@point_count &gt; 0])"/><!-- liczba wezlow potencjalnych licbza PE-->
             <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-->
             <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-->
@@ -161,6 +168,10 @@
                             <xsl:attribute name="bit_max_Pos" select="$bit_max_Pos"/>
                             <xsl:attribute name="bit_max_Pos" select="$bit_max_Pos"/>
                             <xsl:attribute name="id_path" select="@id_path"/>
                             <xsl:attribute name="id_path" select="@id_path"/>
                             <xsl:attribute name="point_count_Pos" select="sum(current-group()/@point_count)"/>
                             <xsl:attribute name="point_count_Pos" select="sum(current-group()/@point_count)"/>
+                            <xsl:attribute name="point_count" select="@point_count"/>
+                            <xsl:attribute name="LineStringCount" select="count( current-group())"/>
+                            <xsl:attribute name="len_sum" select="sum(current-group()/@len)"/>
+                            <!--<xsl:attribute name="GroupPos" select="position()"/>-->
                                 <xsl:for-each select="current-group()">
                                 <xsl:for-each select="current-group()">
                                     <xsl:copy-of select="."/>
                                     <xsl:copy-of select="."/>
                                 </xsl:for-each>
                                 </xsl:for-each>
@@ -174,20 +185,33 @@
             <!-- debug -->
             <!-- debug -->
             <xsl:copy-of select="$PointMatrixGroup"/>
             <xsl:copy-of select="$PointMatrixGroup"/>
             <PointMatrixGroupPE>
             <PointMatrixGroupPE>
-            <xsl:for-each select="$PointMatrixGroup/PointMatrixGroup/PointMatrixGroupPos">
+            <xsl:for-each select="$PointMatrixGroup/PointMatrixGroup">
+                <xsl:for-each select="PointMatrixGroupPos">
                 <xsl:variable name="bit_max_Pos" select="@bit_max_Pos"/>
                 <xsl:variable name="bit_max_Pos" select="@bit_max_Pos"/>
                 <xsl:variable name="point_count_Pos" select="@point_count_Pos"/>
                 <xsl:variable name="point_count_Pos" select="@point_count_Pos"/>
+                <xsl:variable name="distanceGr" select="@distanceGr"/>
+                    <PointMatrixGroup>
+                        <xsl:attribute name="bit_max_Pos" select="$bit_max_Pos"/><xsl:attribute name="point_count_Pos" select="$point_count_Pos"/><xsl:attribute name="distanceGr" select="$distanceGr"/>
+                        <xsl:attribute name="LineStringCount" select="@LineStringCount"/>
+                        <xsl:attribute name="len_sum" select="@len_sum"/>
+                        <xsl:attribute name="point_count_Pos" select="@point_count_Pos"/>
                 <!-- ida kandydaci -->
                 <!-- ida kandydaci -->
-                <xsl:for-each select="distance2[ position() &lt;= $bit_max_Pos  or ( position()=1 and $point_count_Pos &gt; 0 ) ]"> <!-- 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:attribute name="pos" select="@pos"/>
-                        <xsl:attribute name="len" select="@len"/>
-                        <xsl:attribute name="distance" select="@distance"/>
-                        <xsl:attribute name="id_path" select="@id_path"/>
-                        <xsl:attribute name="X" select="$edge_joins_filled_path/edge_joins_filled_paths_xml/asText_XMl/LineString[@id_path = current()/@id_path]/@X"/>
-                        <xsl:attribute name="Y" select="$edge_joins_filled_path/edge_joins_filled_paths_xml/asText_XMl/LineString[@id_path = current()/@id_path]/@Y"/>
-                    </bp:Path_Point>
+                        <xsl:for-each select="distance2[ position() &lt;= $bit_max_Pos  or ( position()=1 and $point_count_Pos &gt; 0 ) ]"> <!-- 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:attribute name="distanceGr" select="$distanceGr"/>
+                                <xsl:attribute name="pos" select="@pos"/>
+                                <xsl:attribute name="len" select="@len"/>
+                                <xsl:attribute name="distance" select="@distance"/>
+                                <xsl:attribute name="cost_dist" select="@cost_dist"/>
+                                <xsl:attribute name="id_path" select="@id_path"/>
+                                
+                                
+                                <xsl:attribute name="X" select="$edge_joins_filled_path/edge_joins_filled_paths_xml/asText_XMl/LineString[@id_path = current()/@id_path]/@X"/>
+                                <xsl:attribute name="Y" select="$edge_joins_filled_path/edge_joins_filled_paths_xml/asText_XMl/LineString[@id_path = current()/@id_path]/@Y"/>
+                            </bp:Path_Point>
+                        </xsl:for-each>
+                    </PointMatrixGroup>
                 </xsl:for-each>
                 </xsl:for-each>
             </xsl:for-each>
             </xsl:for-each>
             </PointMatrixGroupPE>
             </PointMatrixGroupPE>