|
|
@@ -12,6 +12,7 @@
|
|
|
<xsl:variable name="PE_candidates_dump" select="doc('edge_paths_with_PE.xml')"/>
|
|
|
<xsl:variable name="joins_asText" select="doc('joins_asText.xml')"/>
|
|
|
<xsl:variable name="edge_joins_filled_paths" select="doc('edge_joins_filled_paths.xml') "/>
|
|
|
+
|
|
|
<!-- <joins_asText>
|
|
|
<item id="0">POINT (18.7909 51.701067999083)</item>-->
|
|
|
<xsl:template match="joins2ways_z_ID_Way">
|
|
|
@@ -19,14 +20,14 @@
|
|
|
<xsl:variable name="joins_asText_Path_Point">
|
|
|
<xsl:apply-templates select="$joins_asText" mode="joins_asText"/>
|
|
|
</xsl:variable>
|
|
|
- <joins_asText_Path_Point>
|
|
|
- <xsl:copy-of select="$joins_asText_Path_Point"/>
|
|
|
- </joins_asText_Path_Point>
|
|
|
+
|
|
|
+ <!--<xsl:copy-of select="$joins_asText_Path_Point"/>-->
|
|
|
+
|
|
|
<xsl:variable name="edge_joins_filled_paths">
|
|
|
<xsl:apply-templates select="$edge_joins_filled_paths" mode="edge_joins_filled_paths"/>
|
|
|
</xsl:variable>
|
|
|
|
|
|
- <xsl:copy-of select="$edge_joins_filled_paths"/>
|
|
|
+ <!--<xsl:copy-of select="$edge_joins_filled_paths"/>-->
|
|
|
|
|
|
|
|
|
<!-- jedziemy po joins2ways_z_ID_Way, sprawdzamy czy jest dla niego PE_candidates_dump , jak tak, to szukamy jego PE i liczymy sciezke
|
|
|
@@ -35,8 +36,8 @@
|
|
|
<xsl:choose>
|
|
|
<xsl:when test="$PE_candidates_dump/PE_candidates_dump/LINESTRING[@ID_Way=current()/@ID_Way]">
|
|
|
<cable_to_PE_to_be_calculated>
|
|
|
- <xsl:attribute name="Joins" select="@id"/>
|
|
|
<xsl:attribute name="ID_Way" select="@ID_Way"/>
|
|
|
+ <xsl:attribute name="Joins" select="@id"/>
|
|
|
<xsl:variable name="ID_Way" select="@ID_Way"/>
|
|
|
<xsl:variable name="Joins" select="@ID_Way"/>
|
|
|
|
|
|
@@ -44,13 +45,31 @@
|
|
|
<xsl:variable name="Join_X" select="$joins_asText_Path_Point/joins_asText/item[@id=$Joins]/As_POINT_to_xml/@X"/>
|
|
|
<xsl:variable name="Join_Y" select="$joins_asText_Path_Point/joins_asText/item[@id=$Joins]/As_POINT_to_xml/@Y"/>
|
|
|
<xsl:attribute name="Join_X" select="$Join_X"/><xsl:attribute name="Join_Y" select="$Join_Y"/>
|
|
|
- <xsl:for-each select="$edge_joins_filled_paths/edge_joins_filled_paths[@id=$ID_Way]/item/bp:Path_Point">
|
|
|
+ <xsl:for-each select="$edge_joins_filled_paths/edge_joins_filled_paths/item[@id=$ID_Way]/bp:Path_Point">
|
|
|
+ <xsl:variable name="diff_X" select=" number($Join_X)- number(@X)"/><xsl:variable name="diff_Y" select=" number($Join_Y)- number(@Y)"/>
|
|
|
+ <xsl:variable name="bp:Path_Point" select="."/>
|
|
|
<xsl:choose>
|
|
|
- <xsl:when test="@X=$Join_Y and @Y=$Join_Y">
|
|
|
+ <xsl:when test="(abs($diff_X)<0.0001 and abs($diff_X)<0.0001) or ( @X=$Join_X and @Y=$Join_Y )">
|
|
|
<found_in_path_in_edge_joins_filled_path>
|
|
|
+ <xsl:attribute name="diff_X" select="$diff_X"/><xsl:attribute name="diff_Y" select="$diff_Y"/>
|
|
|
+ <xsl:attribute name="position" select="position()"/>
|
|
|
<xsl:copy-of select="."/>
|
|
|
+ <xsl:call-template name="detect_next_PE">
|
|
|
+ <xsl:with-param name="bp:Path_Point" select="$bp:Path_Point"/>
|
|
|
+ <xsl:with-param name="ID_Way" select="$ID_Way"/>
|
|
|
+ <xsl:with-param name="Pos_found" select="position()"/>
|
|
|
+ <xsl:with-param name="edge_joins_filled_paths" select="$edge_joins_filled_paths"/>
|
|
|
+ </xsl:call-template>
|
|
|
</found_in_path_in_edge_joins_filled_path>
|
|
|
</xsl:when>
|
|
|
+ <xsl:otherwise>
|
|
|
+ <not_found>
|
|
|
+ <xsl:attribute name="Pos" select="position()"/>
|
|
|
+ <xsl:attribute name="X" select="@X"/><xsl:attribute name="Y" select="@Y"/>
|
|
|
+ <xsl:attribute name="srch_X" select="$Join_X"/><xsl:attribute name="srch_Y" select="$Join_Y"/>
|
|
|
+ <xsl:attribute name="diff_X" select="$diff_X"/><xsl:attribute name="diff_Y" select="$diff_Y"/>
|
|
|
+ </not_found>
|
|
|
+ </xsl:otherwise>
|
|
|
</xsl:choose>
|
|
|
</xsl:for-each>
|
|
|
</cable_to_PE_to_be_calculated>
|
|
|
@@ -60,6 +79,76 @@
|
|
|
</cables_from_joins_to_PE>
|
|
|
</xsl:template>
|
|
|
|
|
|
+ <!-- na podstawie Joins jade do PE raz z przodudrugi raz z tylu -->
|
|
|
+ <xsl:template name="detect_next_PE">
|
|
|
+ <xsl:param name="bp:Path_Point" required="yes"/>
|
|
|
+ <xsl:param name="Pos_found" required="yes"/>
|
|
|
+ <xsl:param name="ID_Way" required="yes"/>
|
|
|
+ <xsl:param name="edge_joins_filled_paths" required="yes"/>
|
|
|
+ <!--<w_gore><xsl:attribute name="Pos_found" select="$Pos_found"/>
|
|
|
+ <xsl:for-each select="$edge_joins_filled_paths/edge_joins_filled_paths/item[@id=$ID_Way]/bp:Path_Point">
|
|
|
+
|
|
|
+ </xsl:for-each>
|
|
|
+ </w_gore>-->
|
|
|
+
|
|
|
+ <xsl:variable name="Next_PE_Pos" select="min($PE_candidates_dump/PE_candidates_dump/LINESTRING[@ID_Way=$ID_Way]/bp:Path_Point[number(@Pos)>number($Pos_found)]/@Pos)"/>
|
|
|
+ <xsl:variable name="Prev_PE_Pos" select="max($PE_candidates_dump/PE_candidates_dump/LINESTRING[@ID_Way=$ID_Way]/bp:Path_Point[number(@Pos)<=number($Pos_found)]/@Pos)"/>
|
|
|
+ <detect_next_PE>
|
|
|
+ <xsl:attribute name="Pos_found" select="$Pos_found"/>
|
|
|
+ <!--<xsl:copy-of select="$PE_candidates_dump/PE_candidates_dump/LINESTRING[@ID_Way=$ID_Way]/bp:Path_Point[number(@Pos)>number($Pos_found)]/@Pos"/>--> <!--[number(@Pos)>number($Pos_found)]-->
|
|
|
+ <xsl:attribute name="Next_PE_Pos" select="$Next_PE_Pos"/>
|
|
|
+ <xsl:attribute name="Prev_PE_Pos" select="$Prev_PE_Pos"/>
|
|
|
+ <xsl:choose>
|
|
|
+ <xsl:when test="( abs($Pos_found - $Next_PE_Pos)<=abs($Pos_found - $Prev_PE_Pos)) or ( not($Prev_PE_Pos) and $Next_PE_Pos )">
|
|
|
+ <xsl:attribute name="Going_to_next" select="$Next_PE_Pos"/>
|
|
|
+ <xsl:variable name="Path_Point">
|
|
|
+ <xsl:for-each select="$edge_joins_filled_paths/edge_joins_filled_paths/item[@id=$ID_Way]/bp:Path_Point[ position()>=$Pos_found and position()<=$Next_PE_Pos ]">
|
|
|
+ <xsl:copy-of select="."/>
|
|
|
+ </xsl:for-each>
|
|
|
+ </xsl:variable>
|
|
|
+ <xsl:copy-of select="$Path_Point"/>
|
|
|
+ <xsl:call-template name="To_LINESTRING">
|
|
|
+ <xsl:with-param name="Path_Point" select="$Path_Point"/>
|
|
|
+ </xsl:call-template>
|
|
|
+ </xsl:when>
|
|
|
+ <xsl:when test="(abs($Pos_found - $Next_PE_Pos)>abs($Pos_found - $Prev_PE_Pos)) or ( $Prev_PE_Pos and not($Next_PE_Pos) )">
|
|
|
+ <xsl:attribute name="Going_to_prev" select="$Prev_PE_Pos"/>
|
|
|
+ <xsl:variable name="Path_Point">
|
|
|
+ <xsl:for-each select="$edge_joins_filled_paths/edge_joins_filled_paths/item[@id=$ID_Way]/bp:Path_Point[ position()<=$Pos_found and position()>=$Prev_PE_Pos ]">
|
|
|
+ <xsl:copy-of select="."/>
|
|
|
+ </xsl:for-each>
|
|
|
+ </xsl:variable>
|
|
|
+ <xsl:copy-of select="$Path_Point"/>
|
|
|
+ <xsl:call-template name="To_LINESTRING">
|
|
|
+ <xsl:with-param name="Path_Point" select="$Path_Point"/>
|
|
|
+ </xsl:call-template>
|
|
|
+ </xsl:when>
|
|
|
+
|
|
|
+ <xsl:otherwise><xsl:message terminate="yes">#Error 111 - nie moze byc innego wyjatku
|
|
|
+ Pos_found=<xsl:value-of select="$Pos_found"/>;
|
|
|
+ $Next_PE_Pos=<xsl:value-of select="$Next_PE_Pos"/>;
|
|
|
+ $Prev_PE_Pos=<xsl:value-of select="$Prev_PE_Pos"/>;
|
|
|
+ abs($Pos_found - $Next_PE_Pos)=<xsl:value-of select="abs($Pos_found - $Next_PE_Pos)"/>
|
|
|
+ abs($Pos_found - $Prev_PE_Pos)=<xsl:value-of select="abs($Pos_found - $Prev_PE_Pos)"/>
|
|
|
+ </xsl:message></xsl:otherwise>
|
|
|
+ </xsl:choose>
|
|
|
+ </detect_next_PE>
|
|
|
+
|
|
|
+ </xsl:template>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <xsl:template name="To_LINESTRING">
|
|
|
+ <xsl:param name="Path_Point" required="yes"/>
|
|
|
+ <LINESTRING>
|
|
|
+ <xsl:value-of select="'LINESTRING ('"/>
|
|
|
+ <xsl:for-each select="$Path_Point/bp:Path_Point">
|
|
|
+ <xsl:value-of select="concat(@X,' ',@Y)"/>
|
|
|
+ <xsl:if test="position()!=last()"><xsl:value-of select="', '"/></xsl:if>
|
|
|
+ </xsl:for-each>
|
|
|
+ <xsl:value-of select="')'"/>
|
|
|
+ </LINESTRING>
|
|
|
+ </xsl:template>
|
|
|
|
|
|
<xsl:template match="edge_joins_filled_paths" mode="edge_joins_filled_paths">
|
|
|
<edge_joins_filled_paths>
|
|
|
@@ -71,7 +160,16 @@
|
|
|
<item>
|
|
|
<xsl:copy-of select="@*"/>
|
|
|
<xsl:copy-of select="tried"/>
|
|
|
- <xsl:apply-templates/>
|
|
|
+ <xsl:variable name="Path_Point">
|
|
|
+ <xsl:apply-templates/>
|
|
|
+ </xsl:variable>
|
|
|
+ <xsl:copy-of select="$Path_Point/tried"/>
|
|
|
+ <xsl:for-each select="$Path_Point/bp:Path_Point">
|
|
|
+ <bp:Path_Point>
|
|
|
+ <xsl:attribute name="Pos" select="position()"/>
|
|
|
+ <xsl:copy-of select="@*"/>
|
|
|
+ </bp:Path_Point>
|
|
|
+ </xsl:for-each>
|
|
|
</item>
|
|
|
</xsl:template>
|
|
|
|
|
|
@@ -108,6 +206,7 @@
|
|
|
<xsl:attribute name="Y" select="$As_POINT_pos/pos[@pos=2]"/>
|
|
|
</As_POINT_to_xml>
|
|
|
</xsl:template>
|
|
|
+ <xsl:template match="*"/>
|
|
|
|
|
|
|
|
|
</xsl:stylesheet>
|