- java.lang.Object
-
- org.arakhne.afc.gis.primitive.AbstractGISElement<C,T>
-
- org.arakhne.afc.gis.primitive.AbstractBoundedGISElement<GISElementContainer<?>,MapElement>
-
- org.arakhne.afc.gis.mapelement.MapElement
-
- org.arakhne.afc.gis.mapelement.MapPonctualElement
-
- All Implemented Interfaces:
Serializable
,Cloneable
,EventListener
,AttributeChangeListener
,AttributeCollection
,AttributeProvider
,BoundedGISElement
,FlagContainer
,GISCloneable<MapElement>
,GISContentElement<GISElementContainer<?>>
,GISEditable
,GISElement
,GISFlagContainer
,GISPrimitive
,BoundedElement2afp<Rectangle2d>
,JsonableObject
public abstract class MapPonctualElement extends MapElement
This class is for a map element that owns one geo-referenced point.- Since:
- 14.0
- Version:
- 17.0 2020-01-04 14:41:53
- Author:
- Stéphane GALLAND
- See Also:
- Serialized Form
- Maven Group Id:
- org.arakhne.afc.gis
- Maven Artifact Id:
- giscore
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.arakhne.afc.gis.mapelement.MapElement
MapElement.VisualizationType
-
-
Field Summary
-
Fields inherited from class org.arakhne.afc.gis.mapelement.MapElement
ATTR_COLOR, ATTR_USE_CONTAINER_COLOR, ATTR_VISUALIZATION_TYPE
-
Fields inherited from interface org.arakhne.afc.gis.primitive.FlagContainer
FLAG_READONLY, FLAG_SELECTED
-
Fields inherited from interface org.arakhne.afc.gis.primitive.GISElement
ATTR_NAME, NAME_COMPARATOR
-
Fields inherited from interface org.arakhne.afc.gis.primitive.GISPrimitive
COMPARATOR
-
-
Constructor Summary
Constructors Constructor Description MapPonctualElement(UUID id, double geoX, double geoY)
Create a new map element.MapPonctualElement(UUID id, AttributeCollection attributeSource, double geoX, double geoY)
Create a new map element.MapPonctualElement(UUID id, AttributeCollection attributeSource, Point2D<?,?> geo_location)
Create a new map element.MapPonctualElement(UUID id, Point2D<?,?> geo_location)
Create a new map element.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(Point2D<?,?> point, double delta)
Replies if the specified point (x,y) was inside the figure of this MapElement.<OT extends MapPonctualElement>
doubledistance(OT another_point)
Replies the distance between this MapPoint and another_point.boolean
equals(MapElement element)
Replies if the specified objects is the same as this one.double
getDistance(Point2D<?,?> point)
Replies the distance between this MapElement and point.GeoLocation
getGeoLocation()
Replies the geo-location.Point2d
getPoint()
Replies the point coordinates.double
getX()
Replies the x coordinate of the point.double
getY()
Replies the y coordinate of the point.int
hashCode()
void
setLocation(double x, double y)
Set the position of this point.void
setLocation(Point2D<?,?> location)
Set the position of this point.void
toJson(JsonBuffer buffer)
Replies the Json representation of this node.-
Methods inherited from class org.arakhne.afc.gis.mapelement.MapElement
addGISEditableChangeListener, boundsContains, boundsIntersects, clone, contains, equals, finalize, fireElementChanged, fireGraphicalAttributeChanged, fireShapeChanged, getColor, getFlags, getRawColor, getVisualizationType, hasFlag, intersects, isContainerColorUsed, isReadOnlyObject, onAttributeChanged, removeGISEditableChangeListener, resetBoundingBox, setColor, setContainerColorUse, setFlag, setReadOnlyObject, setUUID, setVisualizationType, switchFlag, unsetFlag
-
Methods inherited from class org.arakhne.afc.gis.primitive.AbstractBoundedGISElement
calcBounds, getBoundingBox, setBoundingBox
-
Methods inherited from class org.arakhne.afc.gis.primitive.AbstractGISElement
addAttributeChangeListener, addAttributes, addAttributes, attributes, copyAttributes, flush, freeMemory, getAllAttributeNames, getAllAttributes, getAllAttributesByType, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttributeAsBool, getAttributeAsDate, getAttributeAsDouble, getAttributeAsEnumeration, getAttributeAsEnumeration, getAttributeAsFloat, getAttributeAsInetAddress, getAttributeAsInt, getAttributeAsJavaClass, getAttributeAsLong, getAttributeAsString, getAttributeAsURI, getAttributeAsURL, getAttributeAsUUID, getAttributeCollection, getAttributeCount, getAttributeObject, getAttributeProvider, getContainer, getGeoId, getName, getTopContainer, getUUID, hasAttribute, hashKey, isEventFirable, onAttributeChangeEvent, removeAllAttributes, removeAttribute, removeAttributeChangeListener, renameAttribute, renameAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttributes, setAttributes, setAttributeType, setContainer, setEventFirable, setName, toMap, toMap, toString
-
Methods inherited from interface org.arakhne.afc.attrs.collection.AttributeCollection
addAttributeChangeListener, addAttributes, addAttributes, flush, isEventFirable, removeAllAttributes, removeAttribute, removeAttributeChangeListener, renameAttribute, renameAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttributes, setAttributes, setAttributeType, setEventFirable
-
Methods inherited from interface org.arakhne.afc.attrs.collection.AttributeProvider
attributes, freeMemory, getAllAttributeNames, getAllAttributes, getAllAttributesByType, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttributeAsBool, getAttributeAsDate, getAttributeAsDouble, getAttributeAsEnumeration, getAttributeAsEnumeration, getAttributeAsFloat, getAttributeAsInetAddress, getAttributeAsInt, getAttributeAsJavaClass, getAttributeAsLong, getAttributeAsString, getAttributeAsURI, getAttributeAsURL, getAttributeAsUUID, getAttributeCount, getAttributeObject, hasAttribute, toMap, toMap
-
Methods inherited from interface org.arakhne.afc.gis.primitive.BoundedGISElement
getShape
-
Methods inherited from interface org.arakhne.afc.gis.primitive.GISContentElement
getContainer, getTopContainer, setContainer
-
Methods inherited from interface org.arakhne.afc.gis.primitive.GISEditable
getName, setName
-
Methods inherited from interface org.arakhne.afc.gis.primitive.GISElement
copyAttributes, getName, hashKey, setName
-
Methods inherited from interface org.arakhne.afc.gis.primitive.GISPrimitive
getGeoId, getUUID
-
-
-
-
Constructor Detail
-
MapPonctualElement
public MapPonctualElement(UUID id, double geoX, double geoY)
Create a new map element.- Parameters:
id
- is the unique identifier of this element, ornull
if unknown.geoX
- is a location component of the point in the geo-referenced space.geoY
- is a location component of the point in the geo-referenced space.- Since:
- 4.0
-
MapPonctualElement
public MapPonctualElement(UUID id, Point2D<?,?> geo_location)
Create a new map element.- Parameters:
id
- is the unique identifier of this element, ornull
if unknown.geo_location
- is a location component of the point in the geo-referenced space.- Since:
- 4.0
-
MapPonctualElement
public MapPonctualElement(UUID id, AttributeCollection attributeSource, double geoX, double geoY)
Create a new map element.- Parameters:
id
- is the unique identifier of this element, ornull
if unknown.attributeSource
- is the provider of the attributes for this element.geoX
- is a location component of the point in the geo-referenced space.geoY
- is a location component of the point in the geo-referenced space.- Since:
- 4.0
-
MapPonctualElement
public MapPonctualElement(UUID id, AttributeCollection attributeSource, Point2D<?,?> geo_location)
Create a new map element.- Parameters:
id
- is the unique identifier of this element, ornull
if unknown.attributeSource
- is the provider of the attributes for this element.geo_location
- is a location component of the point in the geo-referenced space.- Since:
- 4.0
-
-
Method Detail
-
toJson
@Pure public void toJson(JsonBuffer buffer)
Description copied from interface:JsonableObject
Replies the Json representation of this node.- Specified by:
toJson
in interfaceJsonableObject
- Overrides:
toJson
in classMapElement
- Parameters:
buffer
- the Json buffer.
-
equals
@Pure public boolean equals(MapElement element)
Description copied from class:MapElement
Replies if the specified objects is the same as this one.- Specified by:
equals
in classMapElement
- Parameters:
element
- the element to compare to.- Returns:
true
if the given element is equal to this object, otherwisefalse
-
hashCode
@Pure public int hashCode()
- Specified by:
hashCode
in classMapElement
-
getGeoLocation
@Pure public GeoLocation getGeoLocation()
Description copied from interface:GISPrimitive
Replies the geo-location.A GeoLocation is unique according to the geo-location of the element. If two elements have the same points in the same order, or if two elements have the same points in a reverse order, they must have equal GeoLocations.
The following code is always true (where the arguments of the constructors are the list of points of the polyline). It illustrates that for two elements with the same geo-localized points, they have the same geo-location identifier (Geo-Id) and they have different unique ientifier (Uid):
GISElement obj1 = new MapPolyline(100,10,200,30,300,4); GISElement obj2 = new MapPolyline(100,10,200,30,300,4); assert( obj1.getGeoId().equals(obj2.getGeoId()) ); assert( obj2.getGeoId().equals(obj1.getGeoId()) ); assert( ! obj1.getUid().equals(obj2.getUid()) ); assert( ! obj2.getUid().equals(obj1.getUid()) );
- Returns:
- a location
- See Also:
GISPrimitive.getGeoId()
,GISPrimitive.getGeoLocation()
-
getPoint
@Pure public Point2d getPoint()
Replies the point coordinates.- Returns:
- the point
-
getX
@Pure public double getX()
Replies the x coordinate of the point.- Returns:
- x
-
getY
@Pure public double getY()
Replies the y coordinate of the point.- Returns:
- y
-
setLocation
public void setLocation(double x, double y)
Set the position of this point.- Parameters:
x
- x coordinatey
- y coordinate
-
setLocation
public void setLocation(Point2D<?,?> location)
Set the position of this point.- Parameters:
location
- the point.
-
distance
@Pure public <OT extends MapPonctualElement> double distance(OT another_point)
Replies the distance between this MapPoint and another_point.Equivalent to:
return another_point.distance(getX(),getY());
- Type Parameters:
OT
- is the type of the given point.- Parameters:
another_point
- another point.- Returns:
- the distance between the given point and this point.
-
getDistance
@Pure public double getDistance(Point2D<?,?> point)
Description copied from class:MapElement
Replies the distance between this MapElement and point.- Specified by:
getDistance
in classMapElement
- Parameters:
point
- the point to compute the distance to.- Returns:
- the distance. Should be negative depending of the MapElement type.
-
contains
@Pure public boolean contains(Point2D<?,?> point, double delta)
Replies if the specified point (x,y) was inside the figure of this MapElement.- Specified by:
contains
in classMapElement
- Parameters:
point
- is a geo-referenced coordinatedelta
- is the geo-referenced distance that corresponds to a approximation distance in the screen coordinate system- Returns:
true
if the specified point has a distance nearest than delta to this element, otherwisefalse
-
-