Преглед изворни кода

poprawki juz jest ID gdzie trzeba

a.binder пре 9 година
родитељ
комит
235afce4c9

+ 10 - 2
SE/dev/php-cli/biale_plamy-generate_data.php

@@ -102,7 +102,7 @@ foreach ($result as $row) {
 
 	if (!(in_array($xpoint->asText(), $joins_asText))) {
 		if (@!in_array($key, $ways2cut[array_search($way->asText(), $ways_asText)])) {
-			$ways2cut[array_search($way->asText(), $ways_asText)][] = $key;
+			$ways2cut[array_search($way->asText(), $ways_asText)][] = array('key'=>$key,'ID_Way'=>$row['ID_Way']);
 		} else echo ".";
 	};
 }
@@ -114,8 +114,11 @@ function pointsDistance($a, $b) {
 
 foreach ($ways2cut as $way_key => $xpoint_keys) {
 	$distances = array();
+	//$xpoint_keys=$value_arr['key'];
 	$way = Vendor_Geophp::load($ways_asText[$way_key], 'wkt');
-	foreach ($xpoint_keys as $xpoint_key) {
+	foreach ($xpoint_keys as $xpoint_key_arr) {
+		$xpoint_key=$xpoint_key_arr['key'];
+		$ID_Way=$xpoint_key_arr['ID_Way'];
 		$xpoint = Vendor_Geophp::load($xpoints[$xpoint_key], 'wkt');
 		$key = array_push($joins_asText, $xpoint->asText())-1;
 		foreach ($xpoints2points[$xpoint_key] as $point_key) {
@@ -134,12 +137,17 @@ foreach ($ways2cut as $way_key => $xpoint_keys) {
 	$endPoint = $way->endPoint();
 	$way = new LineString(array($startPoint, $sub_xpoints[0]));
 	$ways_asText[$way_key] = $way->asText();
+	$ways_2ID_Way[$way_key]=$ID_Way;
+
+	
 	for ($i = 0; $i < $n = count($sub_xpoints) - 1; $i++) {
 		$way = new LineString(array($sub_xpoints[$i], $sub_xpoints[$i+1]));
 		$ways_asText[] = $way->asText();
+		$ways_2ID_Way[]=$ID_Way;
 	}
 	$way = new LineString(array($sub_xpoints[$n], $endPoint));
 	$ways_asText[] = $way->asText();
+	$ways_2ID_Way[]=$ID_Way;
 }
 
 foreach (array_keys($ways_asText) as $way_key) {

+ 140 - 0
SE/dev/php-cli/biale_plamy-schema.xsd

@@ -0,0 +1,140 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
+    targetNamespace="https://procesy5.pl/biale_plamy-schema.xsd"
+    xmlns:bp="https://procesy5.pl/biale_plamy-schema.xsd">
+    <xs:annotation>
+        <xs:documentation>Schemat do opisania struktur potrzebnych oraz generowanych przez rozne funkcje, w celu kontroli projektu oraz lepszej integracji oraz rozwoju</xs:documentation>
+    </xs:annotation>
+    <xs:import namespace="https://procesy5.pl/biale_plamy-schema_out.xsd"
+        schemaLocation="biale_plamy-schema_out.xsd"/>
+    <xs:complexType name="php_scripts">
+        <xs:complexContent>
+            <xs:extension base="bp:php_functions"/>
+        </xs:complexContent>
+    </xs:complexType>
+    <xs:complexType name="func_input"/>
+    <xs:complexType name="func_output"/>
+    <xs:complexType abstract="true" name="php_functions"/>
+    <xs:element name="biale_plamy-generate_data" type="bp:php_scripts"/>
+    <xs:element name="biale_plamy-find_ways" type="bp:php_scripts"/>
+    <xs:complexType name="findWay">
+        <xs:annotation>
+            <xs:documentation>Buduje sciezke po Joins</xs:documentation>
+        </xs:annotation>
+        <xs:complexContent>
+            <xs:extension base="bp:php_functions">
+                <xs:sequence>
+                    <xs:element name="func_input" type="bp:FindWayInput"/>
+                    <xs:element name="func_output" type="bp:func_output"/>
+                </xs:sequence>
+            </xs:extension>
+        </xs:complexContent>
+    </xs:complexType>
+    <xs:complexType name="FindWayInput">
+        <xs:complexContent>
+            <xs:extension base="bp:func_input">
+                <xs:sequence> </xs:sequence>
+            </xs:extension>
+        </xs:complexContent>
+    </xs:complexType>
+    <xs:complexType name="Points"/>
+    <xs:element name="Points" type="bp:Points">
+        <xs:annotation>
+            <xs:documentation>Biale Plamy</xs:documentation>
+        </xs:annotation>
+    </xs:element>
+    <xs:complexType name="Joins">
+        <xs:attribute name="Joins"/>
+    </xs:complexType>
+    <xs:element name="Joins" type="bp:Joins"/>
+    <xs:complexType name="Ways">
+        <xs:attribute name="id"/>
+    </xs:complexType>
+    <xs:element name="Ways" type="bp:Ways"/>
+    <xs:complexType name="Drogi">
+        <xs:attribute name="id"/>
+    </xs:complexType>
+    <xs:element name="Drogi" type="bp:Drogi"/>
+    <xs:complexType name="Joins2Ways">
+        <xs:annotation>
+            <xs:documentation>Array zrobiony przez generate - do wyznaczania Ways i Path 
+- Przelec arraya joins2ways pod katem 1-elementowych subarrayow
+do przeanalizowania przez biale_plamy_joins2ways_do_paths.xsl</xs:documentation>
+        </xs:annotation>
+        <xs:sequence>
+            <xs:element maxOccurs="unbounded" name="item">
+                <xs:complexType>
+                    <xs:sequence>
+                        <xs:element name="item">
+                            <xs:complexType>
+                                <xs:complexContent>
+                                    <xs:extension base="bp:Joins">
+                                        <xs:sequence>
+                                            <xs:element name="item" type="bp:Ways"/>
+                                        </xs:sequence>
+                                    </xs:extension>
+                                </xs:complexContent>
+                            </xs:complexType>
+                        </xs:element>
+                    </xs:sequence>
+                </xs:complexType>
+            </xs:element>
+        </xs:sequence>
+    </xs:complexType>
+    <xs:complexType name="joins2ways_z_ID_Way.xml">
+        <xs:complexContent>
+            <xs:extension base="bp:Joins2Ways"/>
+        </xs:complexContent>
+    </xs:complexType>
+    <xs:element name="Joins2Ways" type="bp:Joins2Ways"/>
+    <xs:element name="Joins2ways_z_ID_Way.xml" type="bp:joins2ways_z_ID_Way.xml"/>
+    <xs:complexType name="Path">
+        <xs:annotation>
+            <xs:documentation>sciezka po Joins na bazie drogi do wyznaczania PE</xs:documentation>
+        </xs:annotation>
+    </xs:complexType>
+    <xs:element name="Path" type="bp:Path"/>
+    <xs:complexType name="EdgeWayJoins"/>
+    <xs:element name="EdgeWayJoins">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="bp:EdgeWayJoins">
+                    <xs:sequence>
+                        <xs:element maxOccurs="unbounded" name="EdgeWayJoinsPair">
+                            <xs:complexType>
+                                <xs:sequence>
+                                    <xs:element maxOccurs="2" minOccurs="2" ref="bp:Joins"/>
+                                </xs:sequence>
+                            </xs:complexType>
+                        </xs:element>
+                    </xs:sequence>
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="points2ID_Way">
+        <xs:annotation>
+            <xs:documentation>generowane przez generate .php do wykrycia z ktorej drogi byly punkty do podpiecia</xs:documentation>
+        </xs:annotation>
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element name="item">
+                    <xs:complexType>
+                        <xs:complexContent>
+                            <xs:extension base="bp:Points">
+                                <xs:sequence>
+                                    <xs:element name="item" type="bp:Drogi"/>
+                                </xs:sequence>
+                            </xs:extension>
+                        </xs:complexContent>
+                    </xs:complexType>
+                </xs:element>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+    <xs:group name="findWay">
+        <xs:sequence>
+            <xs:element name="findWay" type="bp:findWay"/>
+        </xs:sequence>
+    </xs:group>
+</xs:schema>

+ 60 - 0
SE/dev/php-cli/biale_plamy_joins2ways_do_paths.xsl

@@ -0,0 +1,60 @@
+<?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"
+    exclude-result-prefixes="xs"
+    xmlns:bp="https://procesy5.pl/biale_plamy-schema.xsd"
+    version="2.0">
+   <!--<xsl:param name=""></xsl:param>-->
+   
+   <xsl:output indent="yes"/>
+   <xsl:strip-space elements="*"/>
+    <!--example input
+    <joins2ways>
+        <item id="0">
+            <item id="0">0</item>
+            <item id="1">12135</item>
+            <item id="2">29426</item>
+        </item>
+        <item id="1">
+            <item id="0">0</item>
+            <item id="1">1</item>
+            <item id="2">24887</item>
+        </item>
+    </joins2ways>
+    -->
+    
+    <xsl:template match="joins2ways_z_ID_Way">
+        <xsl:variable name="EdgeWayJoinsPair_cand">
+            <xsl:apply-templates mode="joins"/>
+        </xsl:variable>
+        <EdgeWayJoins>
+            <xsl:for-each-group select="$EdgeWayJoinsPair_cand/EdgeWayJoinsPair_cand" group-by="@ID_Way">
+                <EdgeWayJoinsPair>
+                    <xsl:attribute name="ID_Way" select="@ID_Way"/>
+                    <xsl:for-each select="current-group()">
+                        <bp:Joins>
+                            <xsl:attribute name="Joins" select="@joins"/>
+                        </bp:Joins>
+                    </xsl:for-each>
+                </EdgeWayJoinsPair>
+            </xsl:for-each-group>
+        </EdgeWayJoins>
+    </xsl:template>
+    
+    
+    <xsl:template match="item" mode="joins">
+        <xsl:choose>
+            <xsl:when test="count(item)=1">
+                <xsl:element name="EdgeWayJoinsPair_cand">
+                    <xsl:attribute name="joins" select="@id"/>
+                    <xsl:attribute name="ID_Way" select="@ID_Way"/>
+                    <xsl:attribute name="ways" select="item/text()"/>
+                </xsl:element>
+            </xsl:when>
+        </xsl:choose>
+    </xsl:template>
+
+    
+    
+
+</xsl:stylesheet>

+ 25 - 0
SE/dev/php-cli/joins2ways_z_ID_Way.xsl

@@ -0,0 +1,25 @@
+<?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:param name="ways_2ID_Way.xml"  select="'ways_2ID_Way.xml'"/>
+    <xsl:variable name="ways_2ID_Way" select="doc($ways_2ID_Way.xml)"/>
+    
+    <xsl:template match="joins2ways">
+        <joins2ways_z_ID_Way>
+            <xsl:apply-templates/>
+        </joins2ways_z_ID_Way>
+    </xsl:template>
+    <xsl:template match="item">
+        <item>
+            <xsl:copy-of select="@*"/>
+            <xsl:if test="$ways_2ID_Way/ways_2ID_Way/item[@id=current()/item[1]/text()]/text()">
+                <xsl:attribute name="ID_Way" select="$ways_2ID_Way/ways_2ID_Way/item[@id=current()/item[1]/text()]/text()"/>
+            </xsl:if>
+            <xsl:copy-of select="item"/>
+        </item>
+    </xsl:template>
+    
+</xsl:stylesheet>