}
-function getWordSets($aWords, $iDepth)
-{
- $aResult = array(array(join(' ', $aWords)));
- $sFirstToken = '';
- if ($iDepth < 7) {
- while (sizeof($aWords) > 1) {
- $sWord = array_shift($aWords);
- $sFirstToken .= ($sFirstToken?' ':'').$sWord;
- $aRest = getWordSets($aWords, $iDepth+1);
- foreach ($aRest as $aSet) {
- $aResult[] = array_merge(array($sFirstToken), $aSet);
- }
- }
- }
- return $aResult;
-}
-
-function getInverseWordSets($aWords, $iDepth)
-{
- $aResult = array(array(join(' ', $aWords)));
- $sFirstToken = '';
- if ($iDepth < 8) {
- while (sizeof($aWords) > 1) {
- $sWord = array_pop($aWords);
- $sFirstToken = $sWord.($sFirstToken?' ':'').$sFirstToken;
- $aRest = getInverseWordSets($aWords, $iDepth+1);
- foreach ($aRest as $aSet) {
- $aResult[] = array_merge(array($sFirstToken), $aSet);
- }
- }
- }
- return $aResult;
-}
-
-
-function getTokensFromSets($aSets)
-{
- $aTokens = array();
- foreach ($aSets as $aSet) {
- foreach ($aSet as $sWord) {
- $aTokens[' '.$sWord] = ' '.$sWord;
- $aTokens[$sWord] = $sWord;
- }
- }
- return $aTokens;
-}
-
-
function getClassTypes()
{
return array(
//
preg_match_all('/(-?[0-9.]+) (-?[0-9.]+)/', $aMatch[1], $aPolyPoints, PREG_SET_ORDER);
//
- } elseif (preg_match('#MULTIPOLYGON\\(\\(\\(([- 0-9.,]+)#', $geometry_as_text, $aMatch)) {
+/* } elseif (preg_match('#MULTIPOLYGON\\(\\(\\(([- 0-9.,]+)#', $geometry_as_text, $aMatch)) {
//
preg_match_all('/(-?[0-9.]+) (-?[0-9.]+)/', $aMatch[1], $aPolyPoints, PREG_SET_ORDER);
- //
+ */
} elseif (preg_match('#POINT\\((-?[0-9.]+) (-?[0-9.]+)\\)#', $geometry_as_text, $aMatch)) {
//
$aPolyPoints = createPointsAroundCenter($aMatch[1], $aMatch[2], $fRadius);
}
return $aPolyPoints;
}
+
+function closestHouseNumber($aRow)
+{
+ $fHouse = $aRow['startnumber']
+ + ($aRow['endnumber'] - $aRow['startnumber']) * $aRow['fraction'];
+
+ switch ($aRow['interpolationtype']) {
+ case 'odd':
+ $iHn = (int)($fHouse/2) * 2 + 1;
+ break;
+ case 'even':
+ $iHn = (int)(round($fHouse/2)) * 2;
+ break;
+ default:
+ $iHn = (int)(round($fHouse));
+ break;
+ }
+
+ return max(min($aRow['endnumber'], $iHn), $aRow['startnumber']);
+}