| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 |
- <?xml version="1.0" encoding="UTF-8"?>
- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:xs="http://www.w3.org/2001/XMLSchema"
- xmlns:bp="https://procesy5.pl/biale_plamy-schema.xsd"
- exclude-result-prefixes="xs"
- version="2.0">
-
- <xsl:output indent="yes"/>
- <xsl:strip-space elements="*"/>
-
- <xsl:variable name="joins2ways_z_ID_Way" select="doc('joins2ways_z_ID_Way.xml')"/>
-
- <!--//match edge_joins_filled_paths-->
-
-
- <xsl:template match="edge_joins_filled_paths">
- <xsl:variable name="PE_track">
- <xsl:apply-templates/>
- </xsl:variable>
- <!--<PE_track>
- <xsl:copy-of select="$PE_track"/>
- </PE_track>-->
- <xsl:variable name="PE_track">
- <xsl:for-each select="$PE_track/LINESTRING">
- <LINESTRING>
- <xsl:attribute name="Count" select="count(*)"/>
- <xsl:copy-of select="@*"/>
- <!--<xsl:copy-of select="test1"/>-->
- <xsl:for-each select="bp:Path_Point">
- <bp:Path_Point>
- <xsl:copy-of select="@*"/>
- <xsl:attribute name="Pos" select="position()"/>
- <xsl:choose>
- <xsl:when test=" string-length(pos[@pos=1]/text())>1">
- <xsl:attribute name="X" select="pos[@pos=1]"/>
- <xsl:attribute name="Y" select="pos[@pos=2]"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:attribute name="X" select="pos[@pos=2]"/>
- <xsl:attribute name="Y" select="pos[@pos=3]"/>
- </xsl:otherwise>
- </xsl:choose>
- </bp:Path_Point>
- </xsl:for-each>
- </LINESTRING>
- </xsl:for-each>
- </xsl:variable>
- <!--<edge_paths_with_PE>-->
- <!--<SRC>
- <xsl:copy-of select="$PE_track"/>
- </SRC>-->
- <PE_candidates_dump>
- <xsl:call-template name="PE_candidates_dump">
- <xsl:with-param name="edge_paths_with_PE" select="$PE_track"/>
- </xsl:call-template>
- </PE_candidates_dump>
- <!--</edge_paths_with_PE>-->
- </xsl:template>
- <xsl:template name="dumb_frequency">
- <xsl:param name="Count"/>
- <xsl:param name="distance"/>
- <xsl:param name="ID_Point_count"/>
- <xsl:choose>
- <xsl:when test="$ID_Point_count=0">
- <xsl:value-of select="0"/>
- </xsl:when>
- <!--<xsl:when test="$Count<2">
- <xsl:value-of select="2"/>
- </xsl:when>
- <xsl:when test="$Count<3">
- <xsl:value-of select="2"/>
- </xsl:when>
- <xsl:when test="$Count<10">
- <xsl:value-of select="3"/>
- </xsl:when>
- <xsl:when test="$Count<15">
- <xsl:value-of select="5"/>
- </xsl:when>-->
- <xsl:when test="$Count<20">
- <xsl:value-of select="$Count - 1"/>
- </xsl:when>
- <xsl:when test="$Count<30">
- <xsl:value-of select="15"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="20"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="PE_candidates_dump">
- <xsl:param name="edge_paths_with_PE" required="yes"/>
- <xsl:param name="dumb_frequency" select="20"/>
- <xsl:param name="clients_xpoint_count"/> <!--Ile jest na trasie punktow klienckich -->
- <!--<PE_candidates_dump>-->
- <xsl:attribute name="desc" select="'brakuje ominiecia punktow ways tylko do przylaczy i analizy dlugosci'"/>
- <xsl:for-each select="$edge_paths_with_PE/LINESTRING">
- <LINESTRING>
- <xsl:variable name="Count" select="@Count"/>
- <xsl:variable name="ID_Point_count" select="@ID_Point_count"/>
- <xsl:variable name="ID_Way" select="@ID_Way"/>
- <xsl:variable name="distance" select="@distance"/>
- <xsl:variable name="dumb_frequency">
- <xsl:call-template name="dumb_frequency">
- <xsl:with-param name="Count" select="$Count"/>
- <xsl:with-param name="ID_Point_count" select="$ID_Point_count"/>
- <xsl:with-param name="distance" select="$distance"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:attribute name="ID_Way" select="$ID_Way"/>
- <xsl:copy-of select="@*"/>
- <xsl:attribute name="dumb_frequency" select="$dumb_frequency"/>
- <xsl:for-each select="bp:Path_Point">
- <xsl:choose>
- <xsl:when test="(@Pos mod $dumb_frequency = 0 ) and $dumb_frequency >0">
- <xsl:copy-of select="."/>
- </xsl:when>
- </xsl:choose>
- </xsl:for-each>
- </LINESTRING>
- </xsl:for-each>
- <!--</PE_candidates_dump>-->
-
- </xsl:template>
-
- <xsl:template match="item">
- <xsl:choose>
- <xsl:when test="asText">
- <LINESTRING>
- <xsl:attribute name="ID_Way" select="@id"/>
- <xsl:attribute name="ID_Point_count" select="count($joins2ways_z_ID_Way/joins2ways_z_ID_Way/item[@ID_Way=current()/@id and @ID_Point])"/>
- <xsl:attribute name="distance" select="distance/text()"/>
- <xsl:apply-templates/>
- </LINESTRING>
- </xsl:when>
- <xsl:otherwise>
- <bp:Path_Not_Found>
- <xsl:attribute name="ID_Way" select="@id"/>
- </bp:Path_Not_Found>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
-
- <!--<asText>LINESTRING (18.636657356658 51.253416226324, 18.6366871 51.253538999079, 18.6367062
- 51.253605499079, 18.6368933 51.25441199908, 18.6369493 51.254670399079, 18.6370223
- 51.254905799079, 18.6370965 51.255053899079, 18.6371814 51.255153699079, 18.637252
- 51.255236599079, 18.63765 51.255476599079, 18.6386978 51.255913099079, 18.6414059
- 51.257032799079, 18.6449346 51.25849289908, 18.6467805 51.25926169908, 18.64743915153
- 51.259545049387)</asText>-->
- <xsl:template match="asText">
- <xsl:variable name="LINESTRING" select=" substring-before( substring-after(normalize-space(.),'LINESTRING (') , ')') "/>
- <!--<test1><xsl:copy-of select="$LINESTRING"/></test1>-->
- <xsl:for-each select="tokenize($LINESTRING,',')">
- <bp:Path_Point>
- <!--<test2><xsl:copy-of select="."/></test2>-->
- <xsl:for-each select="tokenize(.,' ')">
- <pos>
- <xsl:attribute name="pos" select="position()"/>
- <xsl:value-of select="."/>
- </pos>
- </xsl:for-each>
- </bp:Path_Point>
- </xsl:for-each>
- </xsl:template>
-
- </xsl:stylesheet>
|