-
Notifications
You must be signed in to change notification settings - Fork 0
/
poiconnector.class.php
executable file
·134 lines (124 loc) · 3.01 KB
/
poiconnector.class.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<?php
/*
* PorPOISe
* Copyright 2009 SURFnet BV
* Released under a permissive license (see LICENSE)
*/
/**
* File for abstract POI connector
*
* @package PorPOISe
*/
/**
* POI connector base class
*
* A POI connector is in charge of getting POIs from a specified source.
* Each specific POI connector should be able to open (connect to) the
* specified source and get POI information from it somehow. A POIConnector
* is also in charge of storing POIs in the same format at the same source.
*
* @package PorPOISe
*/
abstract class POIConnector implements iPOIConnector {
/**
* Constructor
*
* Providing a source is a minimal requirement
*
* @param string $source
*/
// public abstract function __construct($source);
/**
* Return POIs
*
* This method should only return POIs that pass the criteria
* stored in $filter. No filter means all POIs.
*
* @param Filter $filter
*
* @return POI[]
*
* @throws Exception
*/
// public abstract function getPOIs(Filter $filter = NULL);
/**
* Get a Layar response
*
* @param Filter $filter
*
* @return LayarResponse
*
* @throws Exception
*/
public function getLayarResponse(Filter $filter = NULL) {
$result = new LayarResponse();
$result->hotspots = $this->getPOIs($filter);
return $result;
}
/**
* Store POIs
*
* Store a set of POIs
*
* @param POI[] $pois POIs to store
* @param string $mode "replace" to replace the current set, "update" to update current set (default)
* @return void
*/
public function storePOIs(array $pois, $mode = "update") {
throw new Exception(__METHOD__ . " has not been implemented");
}
/**
* Save layer properties
*
* Note: uses LayarResponse as transport for properties but will not
* save the contents of $properties->hotspots. Use storePOIs for that
*
* @param LayarResponse $properties
* @param bool $asString
*
* @return mixed FALSE on failure, XML string or TRUE on success
*
* @throws Exception
*/
public function storeLayerProperties(LayarResponse $properties) {
throw new Exception(__METHOD__ . " has not been implemented");
}
/**
* Delete a POI
*
* @param string $poiID ID of the POI to delete
*
* @return void
*
* @throws Exception If the source is invalid or the POI could not be deleted
*/
public function deletePOI($poiID) {
throw new Exception(__METHOD__ . " has not been implemented");
}
/**
* Set a (connector-specific) option
*
* Connectors with specific options, such as an XML stylesheet, should
* override this method to handle those options but always call the
* parent method for unknown options.
*
* @param string $optionName
* @param string $optionValue
*
* @return void
*/
public function setOption($optionName, $optionValue) {
/* no generic options defined as of yet */
}
/**
* Determines whether a POI passes the supplied filter options
*
* @param POI $poi
* @param Filter $filter
*
* @return bool
*/
protected function passesFilter(POI $poi, Filter $filter = NULL) {
return TRUE;
}
}