edge_joins_filled_paths_make.xsl 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3. xmlns:xs="http://www.w3.org/2001/XMLSchema"
  4. xmlns:bp="https://procesy5.pl/biale_plamy-schema.xsd"
  5. exclude-result-prefixes="xs"
  6. version="2.0">
  7. <xsl:param name="ways_as_Text_z_ID_xml.xml" select="'ways_as_Text_z_ID_xml.xml'"/>
  8. <xsl:variable name="ways_asText_z_ID_xml" select="doc($ways_as_Text_z_ID_xml.xml)"/>
  9. <xsl:param name="joins_asText_xml.xml" select="'joins_asText_xml.xml'"/>
  10. <xsl:variable name="joins_asText_xml" select="doc($joins_asText_xml.xml)"/>
  11. <xsl:param name="ways2joins.xml" select="'ways2joins.xml'"/>
  12. <xsl:variable name="ways2joins" select="doc($ways2joins.xml)"/>
  13. <xsl:param name="joins2ways_z_ID_Way.xml" select="'joins2ways_z_ID_Way.xml'"/>
  14. <xsl:variable name="joins2ways_z_ID_Way" select="doc($joins2ways_z_ID_Way.xml)"/>
  15. <xsl:param name="edge_joins_filled_paths" select="'edge_joins_filled_paths'"/> <!-- katalog do zapisywania sciezek -->
  16. <xsl:param name="debug" select="0" /> <!-- set 1 to debug -->
  17. <xsl:output indent="yes"/>
  18. <xsl:strip-space elements="*"/>
  19. <xsl:template match="EdgeWayJoins">
  20. <edge_joins_filled_paths>
  21. <xsl:attribute name="stylesheet" select="'edge_joins_filled_paths_make.xsl'"/>
  22. <xsl:apply-templates/>
  23. </edge_joins_filled_paths>
  24. </xsl:template>
  25. <xsl:template match="EdgeWayJoinsPair">
  26. <item>
  27. <xsl:attribute name="id" select="@ID_Way"/>
  28. <xsl:variable name="ID_Way" select="@ID_Way"/>
  29. <!--<xsl:attribute name="Count" select="$asText/asText/@Count"/>-->
  30. <asText>
  31. <xsl:variable name="bp:Joins">
  32. <xsl:for-each select="bp:Joins">
  33. <bp:Joins>
  34. <xsl:copy-of select="@*"/>
  35. <xsl:copy-of select="$joins_asText_xml/joins_asText_xml/item[@id= current()/@Joins]/bp:Path_Point/@X"/>
  36. <xsl:copy-of select="$joins_asText_xml/joins_asText_xml/item[@id= current()/@Joins]/bp:Path_Point/@Y"/>
  37. <xsl:attribute name="position" select="position()"/>
  38. <!--<xsl:copy-of select="$joins_asText_xml/joins_asText_xml/item[@id= current()/@id]/"/>-->
  39. </bp:Joins>
  40. </xsl:for-each>
  41. </xsl:variable>
  42. <!--<Joins>
  43. <xsl:copy-of select="$bp:Joins"/>
  44. </Joins>-->
  45. <xsl:variable name="Join_X1" select="$bp:Joins/bp:Joins[@position=1]/@X"/>
  46. <xsl:variable name="Join_Y1" select="$bp:Joins/bp:Joins[@position=1]/@Y"/>
  47. <xsl:variable name="Join_X2" select="$bp:Joins/bp:Joins[@position=2]/@X"/>
  48. <xsl:variable name="Join_Y2" select="$bp:Joins/bp:Joins[@position=2]/@Y"/>
  49. <!-- na podstawie joina ustalamy jego wspolrzedne -->
  50. <xsl:variable name="Ways">
  51. <Ways>
  52. <xsl:attribute name="Join_X1" select="$Join_X1"/>
  53. <xsl:attribute name="Join_Y1" select="$Join_Y1"/>
  54. <xsl:attribute name="Join_X2" select="$Join_X2"/>
  55. <xsl:attribute name="Join_Y2" select="$Join_Y2"/>
  56. <xsl:variable name="Ways">
  57. <xsl:for-each select="$ways_asText_z_ID_xml/ways_asText_z_ID_xml/item[@ID_Way=$ID_Way ]"> <!-- olanie zerowych and not(bp:Path_Point[1]/@X= bp:Path_Point[2]/@X) and not(bp:Path_Point[1]/@Y= bp:Path_Point[2]/@Y) TODO -->
  58. <Way>
  59. <xsl:attribute name="id" select="@id"/>
  60. <xsl:attribute name="len" select="@len"/>
  61. <xsl:variable name="bp:Path_Point">
  62. <xsl:for-each select="bp:Path_Point">
  63. <bp:Path_Point>
  64. <xsl:copy-of select="@*"/>
  65. <xsl:attribute name="position" select="position()"/>
  66. </bp:Path_Point>
  67. </xsl:for-each>
  68. </xsl:variable>
  69. <!-- <xsl:variable name="Way_X1" select="$bp:Path_Point/bp:Path_Point[@position=1]/@X"/>
  70. <xsl:variable name="Way_Y1" select="$bp:Path_Point/bp:Path_Point[@position=1]/@Y"/>
  71. <xsl:variable name="Way_X2" select="$bp:Path_Point/bp:Path_Point[@position=2]/@X"/>
  72. <xsl:variable name="Way_Y2" select="$bp:Path_Point/bp:Path_Point[@position=2]/@Y"/>-->
  73. <xsl:attribute name="Way_X1" select="$bp:Path_Point/bp:Path_Point[@position=1]/@X"/>
  74. <xsl:attribute name="Way_Y1" select="$bp:Path_Point/bp:Path_Point[@position=1]/@Y"/>
  75. <xsl:attribute name="Way_X2" select="$bp:Path_Point/bp:Path_Point[@position=2]/@X"/>
  76. <xsl:attribute name="Way_Y2" select="$bp:Path_Point/bp:Path_Point[@position=2]/@Y"/>
  77. </Way>
  78. </xsl:for-each>
  79. </xsl:variable>
  80. <xsl:copy-of select="$Ways"/>
  81. <!-- teraz trzeba wiedziec ktory punkt wziac z drogi - czy pierwszy czy drugi jaki pasuje do pary -->
  82. <xsl:variable name="Ways_J1_W1">
  83. <xsl:for-each select="$Ways/Way[@Way_X1=$Join_X1 and @Way_Y1=$Join_Y1]">
  84. <Way_next_cand>
  85. <xsl:copy-of select="@id"/>
  86. <xsl:copy-of select="@Way_X2"/>
  87. <xsl:copy-of select="@Way_Y2"/>
  88. </Way_next_cand>
  89. </xsl:for-each>
  90. </xsl:variable>
  91. <xsl:copy-of select="$Ways_J1_W1"/>
  92. <xsl:variable name="Ways_J2_W1">
  93. <xsl:for-each select="$Ways/Way[@Way_X1=$Join_X2 and @Way_Y1=$Join_Y2]">
  94. <Way_next_cand>
  95. <xsl:copy-of select="@id"/>
  96. <xsl:copy-of select="@Way_X2"/>
  97. <xsl:copy-of select="@Way_Y2"/>
  98. </Way_next_cand>
  99. </xsl:for-each>
  100. </xsl:variable>
  101. <xsl:copy-of select="$Ways_J2_W1"/>
  102. <xsl:variable name="Ways_J1_W2">
  103. <xsl:for-each select="$Ways/Way[@Way_X2=$Join_X1 and @Way_Y2=$Join_Y1]">
  104. <Way_next_cand>
  105. <xsl:copy-of select="@id"/>
  106. <xsl:copy-of select="@Way_X1"/>
  107. <xsl:copy-of select="@Way_Y1"/>
  108. </Way_next_cand>
  109. </xsl:for-each>
  110. </xsl:variable>
  111. <xsl:copy-of select="$Ways_J1_W2"/>
  112. <xsl:variable name="Ways_J2_W2">
  113. <xsl:for-each select="$Ways/Way[@Way_X2=$Join_X2 and @Way_Y2=$Join_Y2]">
  114. <Way_next_cand>
  115. <xsl:copy-of select="@id"/>
  116. <xsl:copy-of select="@Way_X1"/>
  117. <xsl:copy-of select="@Way_Y1"/>
  118. </Way_next_cand>
  119. </xsl:for-each>
  120. </xsl:variable>
  121. <!-- todo nei wiem czy potrzebne to echo -->
  122. <xsl:copy-of select="$Ways_J2_W2"/>
  123. <!-- poszukamy czy Way_X2 wystepuje -->
  124. </Ways>
  125. </xsl:variable>
  126. <!--<xsl:variable name="Way_1_or_2">
  127. <xsl:choose>
  128. <xsl:when test="$Ways/Ways/Way_next_cand[1]/@Way_X2">
  129. <xsl:value-of select="1"/>
  130. </xsl:when>
  131. <xsl:otherwise><xsl:value-of select="2"/></xsl:otherwise>
  132. </xsl:choose>
  133. </xsl:variable>-->
  134. <!--<Way_1_or_2><xsl:value-of select="$Way_1_or_2"/></Way_1_or_2>-->
  135. <xsl:variable name="LineString">
  136. <xsl:message>#152 run templ PlaceWay for ID_Way=<xsl:value-of select="$ID_Way"/>; </xsl:message>
  137. <xsl:call-template name="PlaceWay">
  138. <xsl:with-param name="Ways" select="$Ways"/>
  139. <xsl:with-param name="Cur_X1" select="$Ways/Ways/@Join_X1"/>
  140. <xsl:with-param name="Cur_Y1" select="$Ways/Ways/@Join_Y1"/>
  141. <xsl:with-param name="Last_X2" select="$Ways/Ways/@Join_X2"/>
  142. <xsl:with-param name="Last_Y2" select="$Ways/Ways/@Join_Y2"/>
  143. <xsl:with-param name="ID_Way" select="$ID_Way"/>
  144. <!--<xsl:with-param name="Way_1_or_2" select="$Way_1_or_2"/>-->
  145. <!--<xsl:with-param name="not_id" select="$Ways/Ways/Way_next_cand/@id"/>-->
  146. </xsl:call-template>
  147. </xsl:variable>
  148. <xsl:variable name="LineString"> <!-- dodanie tylko unikalnego @id_path bo sie chrzani bez tego -->
  149. <xsl:for-each select="$LineString/LineString">
  150. <LineString>
  151. <xsl:copy-of select="@*"/>
  152. <xsl:attribute name="id_path" select="position()"/>
  153. <xsl:copy-of select="child::node()"/>
  154. </LineString>
  155. </xsl:for-each>
  156. </xsl:variable>
  157. <xsl:variable name="len" select="sum($LineString/LineString/@len)"/>
  158. <xsl:attribute name="len" select="$len"/>
  159. <xsl:attribute name="Points_cnt" select="count($LineString/LineString/Points)"/>
  160. <xsl:attribute name="Count" select=" count($LineString/LineString)"/>
  161. <xsl:if test="$debug">
  162. <debug_Ways>
  163. <xsl:copy-of select="$Ways"/>
  164. </debug_Ways>
  165. </xsl:if>
  166. <!-- dodatkowo w xmlu aby bylo prosciej do przetwarzania -->
  167. <!--<asText_XMl>
  168. <xsl:copy-of select="$LineString"/>
  169. </asText_XMl>-->
  170. <xsl:result-document href="{$edge_joins_filled_paths}/edge_joins_filled_paths.{$ID_Way}.xml">
  171. <edge_joins_filled_paths_xml>
  172. <xsl:attribute name="id" select="$ID_Way"/>
  173. <xsl:attribute name="Points_cnt" select="count($LineString/LineString/Points)"/>
  174. <asText_XMl>
  175. <xsl:attribute name="len" select="$len"/>
  176. <xsl:attribute name="id" select="$ID_Way"/>
  177. <xsl:attribute name="Points_cnt" select="count($LineString/LineString/Points)"/>
  178. <xsl:copy-of select="$LineString"/>
  179. </asText_XMl>
  180. </edge_joins_filled_paths_xml>
  181. </xsl:result-document>
  182. <xsl:call-template name="AsText">
  183. <xsl:with-param name="LineString" select="$LineString"/>
  184. </xsl:call-template>
  185. </asText>
  186. </item>
  187. </xsl:template>
  188. <xsl:template name="PlaceWay">
  189. <xsl:param name="Ways" required="yes"/>
  190. <xsl:param name="Cur_X1" required="yes"/>
  191. <xsl:param name="Cur_Y1" required="yes"/>
  192. <!--<xsl:param name="Way_1_or_2" required="yes"/>-->
  193. <xsl:param name="Last_X2" required="yes"/>
  194. <xsl:param name="Last_Y2" required="yes"/>
  195. <xsl:param name="loop" select="1"/>
  196. <xsl:param name="not_id" required="no"/>
  197. <xsl:param name="not_id_prev" required="no" select="-1"/>
  198. <xsl:param name="ID_Way" required="yes"/>
  199. <!--<xsl:if test="$debug">-->
  200. <xsl:message>###PlaceWay(Cur_X1=<xsl:value-of select="$Cur_X1"/>,Cur_Y1=<xsl:value-of select="$Cur_Y1"/>### and not_id=<xsl:value-of select="$not_id"/>;not_id_prev=<xsl:value-of select="$not_id_prev"/>;</xsl:message>
  201. <!--</xsl:if>-->
  202. <!--<LineString>
  203. <xsl:attribute name="X1" select="$Cur_X1"/>
  204. <xsl:attribute name="Y1" select="$Cur_Y1"/>
  205. </LineString>-->
  206. <!--<xsl:choose>
  207. <xsl:when test="$Way_1_or_2"></xsl:when>
  208. </xsl:choose>-->
  209. <!--<debug>
  210. <xsl:attribute name="Cur_X1" select="$Cur_X1"/>
  211. <xsl:attribute name="Cur_Y1" select="$Cur_Y1"/>
  212. <xsl:attribute name="not_id" select="$not_id"/>
  213. </debug>-->
  214. <xsl:variable name="Linestring">
  215. <!-- jezeli sa zerowe drogi -->
  216. <xsl:choose>
  217. <xsl:when test="$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 and not(@id=$not_id_prev) ][1]">
  218. <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 and not(@id=$not_id_prev) ][1]">
  219. <LineString>
  220. <xsl:attribute name="error" select="'zerowa droga!'"/>
  221. <xsl:attribute name="X" select="@Way_X2"/>
  222. <xsl:attribute name="Y" select="@Way_Y2"/>
  223. <xsl:attribute name="not_id" select="@id"/>
  224. <xsl:attribute name="len" select="@len"/>
  225. <!--<xsl:if test="$debug">-->
  226. <xsl:message>Try to say @Way_X1:<xsl:value-of select="@Way_X1"/>; @Way_X2:<xsl:value-of select="@Way_X2"/>; $Cur_X1:<xsl:value-of select="$Cur_X1"/>; </xsl:message>
  227. <xsl:message>PlaceWay: 1=1;2=2 count()=<xsl:value-of select="count(.)"/>; lenX:<xsl:value-of select=" round(abs(number(@Way_X1) - number($Cur_X1)) * 1000)"/>; zerowa droga dla $Cur_X1=<xsl:value-of select="$Cur_X1"/>; $Cur_Y1=<xsl:value-of select="$Cur_Y1"/> @id=<xsl:value-of select="@id"/>; $not_id=<xsl:value-of select="$not_id"/>;$not_id_prev=<xsl:value-of select="$not_id_prev"/>;</xsl:message>
  228. <!--</xsl:if>-->
  229. <xsl:attribute name="not_id_prev" select="$not_id"/>
  230. <xsl:variable name="X" select="@Way_X2"/>
  231. <xsl:variable name="Y" select="@Way_Y2"/>
  232. <xsl:for-each select="$ways2joins/ways2joins/item[@id= current()/@id]/item"> <!-- musi byc wczesniej bo atrybut sie nie doda drugi raz-->
  233. <xsl:for-each select="$joins_asText_xml/joins_asText_xml/item[@id= current()/text()]/bp:Path_Point">
  234. <xsl:if test="@X=$X and @Y=$Y">
  235. <xsl:variable name="ID_Join" select="parent::node()/@id"/>
  236. <xsl:attribute name="ID_Join" select="$ID_Join"/>
  237. </xsl:if>
  238. </xsl:for-each>
  239. </xsl:for-each>
  240. <xsl:for-each select="$ways2joins/ways2joins/item[@id= current()/@id]/item">
  241. <xsl:for-each select="$joins_asText_xml/joins_asText_xml/item[@id= current()/text()]/bp:Path_Point">
  242. <xsl:if test="@X=$X and @Y=$Y">
  243. <xsl:variable name="ID_Join" select="parent::node()/@id"/>
  244. <!--<xsl:attribute name="ID_Join" select="$ID_Join"/>-->
  245. <!-- punkty podpiete -->
  246. <xsl:copy-of select="$joins2ways_z_ID_Way/joins2ways_z_ID_Way/item[@id=$ID_Join]/Points"/>
  247. <!-- wyszukanie drog wychodzacych innych niz nasza z punktu -->
  248. <xsl:for-each select="$joins2ways_z_ID_Way/joins2ways_z_ID_Way/item[@id=$ID_Join]/item[not(@ID_WAY=$ID_Way)]">
  249. <Ways>
  250. <xsl:attribute name="ID_WAY" select="@ID_WAY"/>
  251. <xsl:attribute name="ways_id" select="text()"/>
  252. </Ways>
  253. </xsl:for-each>
  254. </xsl:if>
  255. </xsl:for-each>
  256. </xsl:for-each>
  257. </LineString>
  258. </xsl:for-each>
  259. </xsl:when>
  260. <xsl:otherwise>
  261. <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) or not(@Way_Y1=@Way_Y2) ) and not(@id=$not_id_prev) ]">
  262. <LineString>
  263. <xsl:attribute name="X" select="@Way_X2"/>
  264. <xsl:attribute name="Y" select="@Way_Y2"/>
  265. <xsl:attribute name="not_id" select="@id"/>
  266. <xsl:attribute name="len" select="@len"/>
  267. <xsl:attribute name="not_id_prev" select="$not_id"/>
  268. <xsl:variable name="X" select="@Way_X2"/>
  269. <xsl:variable name="Y" select="@Way_Y2"/>
  270. <xsl:choose>
  271. <xsl:when test="number(count(@Way_X2)) &gt; number(1)"><xsl:message>#282 error count&gt; of @Way_X2<xsl:value-of select="@Way_X2"/> </xsl:message></xsl:when>
  272. <xsl:otherwise>
  273. <!--<xsl:if test=" abs(number(@Way_X2) - number($Cur_X1)) &gt; 0.001 ">
  274. <xsl:message>#326 too long way <xsl:value-of select="abs(number(@Way_X2) - number($Cur_X1))"/></xsl:message>
  275. </xsl:if>-->
  276. <xsl:if test="$debug">
  277. <xsl:message>Try to say @Way_X1:<xsl:value-of select="@Way_X1"/>; @Way_X2:<xsl:value-of select="@Way_X2"/>; $Cur_X1:<xsl:value-of select="$Cur_X1"/>; </xsl:message>
  278. <xsl:message>PlaceWay: 1=1 count()=<xsl:value-of select="count(.)"/>; number(@Way_X2)<xsl:value-of select="@Way_X2"/> lenX:<xsl:value-of select=" round(number(@Way_X2) - number($Cur_X1) * 100) "/>; dla $Cur_X1=<xsl:value-of select="$Cur_X1"/>; $Cur_Y1=<xsl:value-of select="$Cur_Y1"/> @id=<xsl:value-of select="@id"/>; $not_id=<xsl:value-of select="$not_id"/>;$not_id_prev=<xsl:value-of select="$not_id_prev"/>;</xsl:message>
  279. </xsl:if>
  280. </xsl:otherwise>
  281. </xsl:choose>
  282. <xsl:for-each select="$ways2joins/ways2joins/item[@id= current()/@id]/item"> <!-- musi byc wczesniej bo atrybut sie nie doda drugi raz-->
  283. <xsl:for-each select="$joins_asText_xml/joins_asText_xml/item[@id= current()/text()]/bp:Path_Point">
  284. <xsl:if test="@X=$X and @Y=$Y">
  285. <xsl:variable name="ID_Join" select="parent::node()/@id"/>
  286. <xsl:attribute name="ID_Join" select="$ID_Join"/>
  287. </xsl:if>
  288. </xsl:for-each>
  289. </xsl:for-each>
  290. <xsl:for-each select="$ways2joins/ways2joins/item[@id= current()/@id]/item">
  291. <xsl:for-each select="$joins_asText_xml/joins_asText_xml/item[@id= current()/text()]/bp:Path_Point">
  292. <xsl:if test="@X=$X and @Y=$Y">
  293. <xsl:variable name="ID_Join" select="parent::node()/@id"/>
  294. <!--<xsl:attribute name="ID_Join" select="$ID_Join"/>-->
  295. <!-- punkty podpiete -->
  296. <xsl:copy-of select="$joins2ways_z_ID_Way/joins2ways_z_ID_Way/item[@id=$ID_Join]/Points"/>
  297. <!-- wyszukanie drog wychodzacych innych niz nasza z punktu -->
  298. <xsl:for-each select="$joins2ways_z_ID_Way/joins2ways_z_ID_Way/item[@id=$ID_Join]/item[not(@ID_WAY=$ID_Way)]">
  299. <Ways>
  300. <xsl:attribute name="ID_WAY" select="@ID_WAY"/>
  301. <xsl:attribute name="ways_id" select="text()"/>
  302. </Ways>
  303. </xsl:for-each>
  304. </xsl:if>
  305. </xsl:for-each>
  306. </xsl:for-each>
  307. </LineString>
  308. </xsl:for-each>
  309. <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) or not(@Way_Y1=@Way_Y2) ) and not(@id=$not_id_prev) ]">
  310. <LineString>
  311. <xsl:attribute name="X" select="@Way_X1"/>
  312. <xsl:attribute name="Y" select="@Way_Y1"/>
  313. <xsl:attribute name="not_id" select="@id"/>
  314. <xsl:attribute name="len" select="@len"/>
  315. <xsl:attribute name="not_id_prev" select="$not_id"/>
  316. <xsl:variable name="X" select="@Way_X1"/>
  317. <xsl:variable name="Y" select="@Way_Y1"/>
  318. <xsl:if test="$debug">
  319. <xsl:message>PlaceWay: 1=2 count()=<xsl:value-of select="count(.)"/>; lenX:<xsl:value-of select=" round(number(@Way_X1) - number($Cur_X1) * 100)"/>; dla $Cur_X1=<xsl:value-of select="$Cur_X1"/>; $Cur_Y1=<xsl:value-of select="$Cur_Y1"/> @id=<xsl:value-of select="@id"/>; $not_id=<xsl:value-of select="$not_id"/>;</xsl:message>
  320. </xsl:if>
  321. <xsl:if test=" abs(number(@Way_X1) - number($Cur_X1)) &gt; 0.001 ">
  322. <xsl:message>#326 too long way <xsl:value-of select="abs(number(@Way_X1) - number($Cur_X1))"/></xsl:message>
  323. </xsl:if>
  324. <xsl:for-each select="$ways2joins/ways2joins/item[@id= current()/@id]/item"> <!-- musi byc wczesniej bo atrybut sie nie doda drugi raz-->
  325. <xsl:for-each select="$joins_asText_xml/joins_asText_xml/item[@id= current()/text()]/bp:Path_Point">
  326. <xsl:if test="@X=$X and @Y=$Y">
  327. <xsl:variable name="ID_Join" select="parent::node()/@id"/>
  328. <xsl:attribute name="ID_Join" select="$ID_Join"/>
  329. </xsl:if>
  330. </xsl:for-each>
  331. </xsl:for-each>
  332. <xsl:for-each select="$ways2joins/ways2joins/item[@id= current()/@id]/item">
  333. <xsl:for-each select="$joins_asText_xml/joins_asText_xml/item[@id= current()/text()]/bp:Path_Point">
  334. <xsl:if test="@X=$X and @Y=$Y">
  335. <xsl:variable name="ID_Join" select="parent::node()/@id"/>
  336. <!-- punkty podpiete -->
  337. <xsl:copy-of select="$joins2ways_z_ID_Way/joins2ways_z_ID_Way/item[@id=$ID_Join]/Points"/>
  338. <!-- wyszukanie drog wychodzacych innych niz nasza z punktu -->
  339. <xsl:for-each select="$joins2ways_z_ID_Way/joins2ways_z_ID_Way/item[@id=$ID_Join]/item[not(@ID_WAY=$ID_Way)]">
  340. <Ways>
  341. <xsl:attribute name="ID_WAY" select="@ID_WAY"/>
  342. <xsl:attribute name="ways_id" select="text()"/>
  343. </Ways>
  344. </xsl:for-each>
  345. </xsl:if>
  346. </xsl:for-each>
  347. </xsl:for-each>
  348. </LineString>
  349. </xsl:for-each>
  350. </xsl:otherwise>
  351. </xsl:choose>
  352. </xsl:variable>
  353. <xsl:copy-of select="$Linestring"/>
  354. <xsl:choose>
  355. <xsl:when test="$loop &gt; 1000">
  356. <loop_limit>
  357. <xsl:message terminate="yes">
  358. !!!!!!!!!!!!!!!! Loop limit dla PlaceWay: 1=2 dla $Cur_X1=<xsl:value-of select="$Cur_X1"/>; $Cur_Y1=<xsl:value-of select="$Cur_Y1"/> @id=<xsl:value-of select="@id"/>; $not_id=<xsl:value-of select="$not_id"/>
  359. </xsl:message>
  360. </loop_limit>
  361. </xsl:when>
  362. <xsl:when test="$Linestring/LineString/@X = $Last_X2 and $Linestring/LineString/@Y = $Last_Y2 ">
  363. <ostatni/>
  364. </xsl:when>
  365. <xsl:otherwise>
  366. <xsl:if test="$debug">
  367. <xsl:message>call-templ with Cur_X1=<xsl:value-of select="$Linestring/LineString/@X"/>; not_id=<xsl:value-of select="$Linestring/LineString/@not_id"/>; not_id_prev=<xsl:value-of select="$Linestring/LineString/@not_id_prev"/></xsl:message>
  368. </xsl:if>
  369. <xsl:call-template name="PlaceWay">
  370. <xsl:with-param name="Ways" select="$Ways"/>
  371. <xsl:with-param name="Cur_X1" select="$Linestring/LineString/@X"/>
  372. <xsl:with-param name="Cur_Y1" select="$Linestring/LineString/@Y"/>
  373. <xsl:with-param name="Last_X2" select="$Last_X2"/>
  374. <xsl:with-param name="Last_Y2" select="$Last_Y2"/>
  375. <xsl:with-param name="not_id" select="$Linestring/LineString/@not_id"/>
  376. <xsl:with-param name="not_id_prev" select="$Linestring/LineString/@not_id_prev"></xsl:with-param>
  377. <xsl:with-param name="loop" select="$loop+1"/>
  378. <xsl:with-param name="ID_Way" select="$ID_Way"/>
  379. </xsl:call-template>
  380. </xsl:otherwise>
  381. </xsl:choose>
  382. </xsl:template>
  383. <!--<xsl:template name="AsText_XML">
  384. <xsl:param name="LineString" required="yes"/>
  385. <xsl:for-each select="$LineString/LineString">
  386. <PathPoint>
  387. <xsl:copy-of select="@*"/>
  388. </PathPoint>
  389. </xsl:for-each>
  390. </xsl:template>-->
  391. <xsl:template name="AsText">
  392. <xsl:param name="LineString" required="yes"/>
  393. <xsl:value-of select="'LINESTRING ('"/>
  394. <xsl:for-each select="$LineString/LineString">
  395. <xsl:value-of select="concat(@X,' ',@Y)"/>
  396. <xsl:if test="not(position()= last())">
  397. <xsl:value-of select="', '"/>
  398. </xsl:if>
  399. </xsl:for-each>
  400. <xsl:value-of select="')'"/>
  401. </xsl:template>
  402. </xsl:stylesheet>