no.uio.edd.model.geo.map
Class GeoPlace

java.lang.Object
  extended by no.uio.edd.utils.geoutils.GeoFeature
      extended by no.uio.edd.model.geo.map.GeoPlace
All Implemented Interfaces:
GeoMaplike

public class GeoPlace
extends GeoFeature
implements GeoMaplike

A class used to store a place in a map model. The myId is the same as the RDF url for the node it was based on.

Author:
oeide

Nested Class Summary
 
Nested classes/interfaces inherited from class no.uio.edd.utils.geoutils.GeoFeature
GeoFeature.possibleForms
 
Field Summary
(package private)  int relationshipCounter
           
 
Fields inherited from class no.uio.edd.utils.geoutils.GeoFeature
coordSyst, coordSystNumeric, KOORD_NAME_GENERALSTABEN, KOORD_NAME_REKTANGEL, MAP_IDENT_GENERALSTABEN, MAP_IDENT_REKTANGEL, myId, OFFSET_CHRA, OFFSET_STHLM
 
Constructor Summary
GeoPlace(java.lang.String id, GeoMap inGeoMap)
           
 
Method Summary
 java.lang.String addAnnotation(java.lang.String newAnn)
          Add to the list of annotation.
 GeoEvent addEvent(java.lang.String id)
          Add a new event to this place.
 GeoRelationship addGeoRelationshipToMe(GeoRelationship newRel)
          Adds a new relationship for which I am the target.
 void addType(java.lang.String type)
          Adds another type to my list of types.
 java.lang.String asCoordList()
           
 java.lang.String asGML()
          The GML fragment returned by this method should contain everything from the level of the specific geometry, that is, from gml:Point, gml:Polygon, etc.
 int countRelationshipsWithoutSpec()
          That is, relationships where neither direction, distance, isPartOf nor isBetween is set.
 boolean coveredByMe(GeoPlace gp)
           
 boolean doIHaveParts()
          Checks if any other plaves are part of me.
 void doubleMySize()
          Double the size of my spatial object.
 GeoRelationship[] getConnectedToMe()
           
 double getDirection()
           
 GeoRelationship getGeoRelationship(GeoPlace target)
          Will return the GeoRelationship to the target GeoPlace if it exists.
 java.lang.String getId()
          The same as the RDF url for the node the object was based on.
 double getLength()
           
 GeoPoint getMidpoint()
           
 java.lang.String[] getMyAnnotions()
           
 GeoRelationship[] getMyConnections()
           
 GeoEvent[] getMyEvents()
           
 GeoFeature getMyFeatureObject()
           
 GeoMap getMyGeoMap()
           
 int getMyLayerNum()
           
 GeoPolyline getMyLine()
           
 GeoPolygon getMyPolygon()
           
 java.lang.String getMyPreferredName()
           
 double getMySize()
           
 double getMySizeX()
           
 double getMySizeY()
           
 int getRelationshipCount()
           
 int getRelationshipCountWithBetweenRelationship()
           
 int getRelationshipCountWithDirection()
           
 int getRelationshipCountWithDistance()
           
 int getRelationshipCountWithPartRelationship()
           
 GeoPlace[] getTheOnesIAmBetween()
           
 java.lang.String[] getTypes()
           
 double getWidth()
           
 void interpretMeasurements()
          Interpret measurements and decide if it is a point, line or polygon, then create the spatial object with coordinates.
 boolean moveMeToTheBorder(GeoPlace theBorderOfThis, double direction)
           
 void moveMyGeos(double offsetX, double offsetY)
          Move all the geographical objects I have.
 int myLayerSize()
           
 java.lang.String putMeBetween(GeoPlace place1, GeoPlace place2)
          Put this GeoPlace object between the two others.
 boolean rotateMyGeometryAccordingToDirection()
           
 void setDirection(double direction)
           
 void setLength(double length)
           
 void setMyLayerNum(int myLayerNum)
           
 void setMyLine(GeoPolyline myLine)
           
 GeoPoint setMyLocation(double x, double y)
          Set my midpoint location.
 void setMyMidpoint(GeoPoint myMidpoint)
          Midpoint has a double function, both as the point location of this place, or as the midpoint for a line or polygon location.
 void setMyPolygon(double x1, double y1, double x2, double y2)
          Sets my polygon as the simplest possible polygon: rectangle parallel to x and y axis of coordinate system.
 void setMyPolygon(GeoPolygon myPoly)
           
 void setMyPreferredName(java.lang.String myPreferredName)
           
 void setWidth(double width)
           
static GeoPlace[] toGeoPlaceArr(ExtendableObjectList objList)
          Convert an ExtendableObjectList containing GeoPlace objects to a GeoPlace array, removing null elements.
 java.lang.String toString()
           
 
Methods inherited from class no.uio.edd.utils.geoutils.GeoFeature
getGmlFooter, getGmlHeader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

relationshipCounter

int relationshipCounter
Constructor Detail

GeoPlace

public GeoPlace(java.lang.String id,
                GeoMap inGeoMap)
Parameters:
id - The same as the RDF url for the node the object was based on.
myPreferredName -
Method Detail

asGML

public java.lang.String asGML()
Description copied from class: GeoFeature
The GML fragment returned by this method should contain everything from the level of the specific geometry, that is, from gml:Point, gml:Polygon, etc.

Specified by:
asGML in interface GeoMaplike
Specified by:
asGML in class GeoFeature
Returns:
An XML-GML fragment representing my vector geometry, if application; otherwise, return an empty string.

setMyMidpoint

public void setMyMidpoint(GeoPoint myMidpoint)
Midpoint has a double function, both as the point location of this place, or as the midpoint for a line or polygon location.

Parameters:
myMidpoint - the myMidpoint to set

getMyLine

public GeoPolyline getMyLine()
Returns:
the myLine

setMyLine

public void setMyLine(GeoPolyline myLine)
Parameters:
myLine - the myLine to set

getMyPolygon

public GeoPolygon getMyPolygon()
Returns:
the myPolygon

setMyPolygon

public void setMyPolygon(double x1,
                         double y1,
                         double x2,
                         double y2)
Sets my polygon as the simplest possible polygon: rectangle parallel to x and y axis of coordinate system.

Parameters:
x1 - Coordinate 1.
y1 - Coordinate 1.
x2 - Coordinate 2.
y2 - Coordinate 2.

setMyPolygon

public void setMyPolygon(GeoPolygon myPoly)
Parameters:
myPoly - The polygon to set.

getMyPreferredName

public java.lang.String getMyPreferredName()
Returns:
the myPreferredName

setMyPreferredName

public void setMyPreferredName(java.lang.String myPreferredName)
Parameters:
myPreferredName - the myPreferredName to set

getId

public java.lang.String getId()
The same as the RDF url for the node the object was based on.

Returns:
the id

asCoordList

public java.lang.String asCoordList()
Specified by:
asCoordList in class GeoFeature

getMyConnections

public GeoRelationship[] getMyConnections()
Returns:
An array including all the relationships of which I am the domain.

getConnectedToMe

public GeoRelationship[] getConnectedToMe()
Returns:
An array including all the relationships of which I am the range.

getMyEvents

public GeoEvent[] getMyEvents()
Returns:
An array including all the events of which I am the location.

getGeoRelationship

public GeoRelationship getGeoRelationship(GeoPlace target)
Will return the GeoRelationship to the target GeoPlace if it exists. If not, it will be created and returned.

Parameters:
target - The target of the relationship.
Returns:
The relationship object.

addGeoRelationshipToMe

public GeoRelationship addGeoRelationshipToMe(GeoRelationship newRel)
Adds a new relationship for which I am the target.

Parameters:
newRel - The new relationship.
Returns:
The new relationship.

addAnnotation

public java.lang.String addAnnotation(java.lang.String newAnn)
Add to the list of annotation.

Parameters:
newAnn - The new annotation.
Returns:
The new annotation.

getMyAnnotions

public java.lang.String[] getMyAnnotions()
Returns:
An array with all my annotations.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getLength

public double getLength()
Returns:
the length

setLength

public void setLength(double length)
Parameters:
length - the length to set

getWidth

public double getWidth()
Returns:
the width

setWidth

public void setWidth(double width)
Parameters:
width - the width to set

getDirection

public double getDirection()
Returns:
the direction

setDirection

public void setDirection(double direction)
Parameters:
direction - the direction to set

getTypes

public java.lang.String[] getTypes()
Returns:
An array including all the types.

addType

public void addType(java.lang.String type)
Adds another type to my list of types.

Parameters:
type - the type to add

getMyLayerNum

public int getMyLayerNum()
Returns:
the myLayerNum

setMyLayerNum

public void setMyLayerNum(int myLayerNum)
Parameters:
myLayerNum - the myLayerNum to set

addEvent

public GeoEvent addEvent(java.lang.String id)
Add a new event to this place. If it does not exist it will be created.

Parameters:
id - The ID of the new event.
Returns:
The new event.

toGeoPlaceArr

public static GeoPlace[] toGeoPlaceArr(ExtendableObjectList objList)
Convert an ExtendableObjectList containing GeoPlace objects to a GeoPlace array, removing null elements.

Parameters:
objList - The object list.
Returns:
The array.

doIHaveParts

public boolean doIHaveParts()
Checks if any other plaves are part of me.

Returns:
true if I have at least one places as part of me.

interpretMeasurements

public void interpretMeasurements()
Interpret measurements and decide if it is a point, line or polygon, then create the spatial object with coordinates.


getMyFeatureObject

public GeoFeature getMyFeatureObject()

myLayerSize

public int myLayerSize()

getMyGeoMap

public GeoMap getMyGeoMap()

getMidpoint

public GeoPoint getMidpoint()
Specified by:
getMidpoint in class GeoFeature

setMyLocation

public GeoPoint setMyLocation(double x,
                              double y)
Set my midpoint location. This will move my polyline or polygon as well, as well as all the other places in my layer.

Parameters:
x - New X location.
y - New Y location.
Returns:
The new midpoint object.

moveMyGeos

public void moveMyGeos(double offsetX,
                       double offsetY)
Move all the geographical objects I have. This does not move the rest of my layer.

Parameters:
offsetX - Movement in X direction.
offsetY - Movement in Y direction.

getMySize

public double getMySize()

doubleMySize

public void doubleMySize()
Double the size of my spatial object. If it is a point, create a standard size polygon. TODO: Must also possibly change the size of all other places I am part of.


coveredByMe

public boolean coveredByMe(GeoPlace gp)

getTheOnesIAmBetween

public GeoPlace[] getTheOnesIAmBetween()
                                throws GeoModelLocationException
Throws:
GeoModelLocationException

putMeBetween

public java.lang.String putMeBetween(GeoPlace place1,
                                     GeoPlace place2)
                              throws GeoModelLocationException
Put this GeoPlace object between the two others.

Parameters:
place1 - The first place.
place2 - The second place.
Returns:
An empty string on success, error message on failure.
Throws:
GeoModelLocationException

moveMeToTheBorder

public boolean moveMeToTheBorder(GeoPlace theBorderOfThis,
                                 double direction)

getMySizeX

public double getMySizeX()

getMySizeY

public double getMySizeY()

getRelationshipCount

public int getRelationshipCount()

countRelationshipsWithoutSpec

public int countRelationshipsWithoutSpec()
That is, relationships where neither direction, distance, isPartOf nor isBetween is set.

Returns:
The number of such relationships

getRelationshipCountWithDirection

public int getRelationshipCountWithDirection()

getRelationshipCountWithDistance

public int getRelationshipCountWithDistance()

getRelationshipCountWithPartRelationship

public int getRelationshipCountWithPartRelationship()

getRelationshipCountWithBetweenRelationship

public int getRelationshipCountWithBetweenRelationship()

rotateMyGeometryAccordingToDirection

public boolean rotateMyGeometryAccordingToDirection()