001: /*
002: * GeoTools - OpenSource mapping toolkit
003: * http://geotools.org
004: * (C) 2003-2006, Geotools Project Managment Committee (PMC)
005: * (C) 2003 Refractions Research Inc.
006: *
007: * This library is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU Lesser General Public
009: * License as published by the Free Software Foundation; either
010: * version 2.1 of the License, or (at your option) any later version.
011: *
012: * This library is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * Refractions Research Inc. Can be found on the web at:
018: * http://www.refractions.net/
019: */
020: package org.geotools.data.oracle.sdo;
021:
022: import com.vividsolutions.jts.geom.CoordinateSequence;
023:
024: /**
025: * Allows manipulation of a Geometry's CoordianteSequece.
026: *
027: * <p>
028: * The number of ordinates in each Coordiante is getDimension() + getNumAttributes()<br>
029: * The examples given in this interface are based on a 2-dimensional
030: * coordinate system, x and y,<br>
031: * with two attributes: z and t.<br>
032: * In this case z is the third dimension, but is not used for rendering and
033: * the coordinate<br>
034: * remains 2-dimensional.
035: * </p>
036: *
037: * @author jgarnett
038: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/unsupported/oracle-spatial/src/main/java/org/geotools/data/oracle/sdo/CoordinateAccess.java $
039: */
040: public interface CoordinateAccess extends CoordinateSequence {
041: /**
042: * Retrieve the number of spatial dimensions of Coordiantes.
043: *
044: * <p>
045: * This is the number of spatially significant ordiantes (usually 2 or 3)
046: * </p>
047: *
048: * @return Number of spatially signficant ordinates
049: */
050: int getDimension();
051:
052: /**
053: * Retrieve number of measures associated with a Coordiantes
054: *
055: * <p>
056: * This is the number of non spatially significant ordinates.
057: * </p>
058: *
059: * @return Number of measures, or 0 if measures not used
060: */
061: int getNumAttributes();
062:
063: /**
064: * Retrive a single ordinate
065: *
066: * @param coordinate Coordinate to retrive from
067: * @param ordinate Ordinate to retrive from coordiante
068: *
069: * @return Specified ordinate
070: */
071: double getOrdinate(int coordinate, int ordinate);
072:
073: /**
074: * getAttribute purpose.
075: *
076: * <p>
077: * attribute is between 0 and getNumAttributes()
078: * </p>
079: *
080: * @param coordinate
081: * @param attribute is between 0 and getNumAttributes()
082: *
083: */
084: Object getAttribute(int coordinate, int attribute);
085:
086: /**
087: * Set a single ordinate.
088: *
089: * @param coordinate Corrdinate to modify
090: * @param ordinate Ordinate to modify in coordinate
091: * @param value new value
092: */
093: void setOrdinate(int coordinate, int ordinate, double value);
094:
095: /**
096: * setAttribute purpose.
097: *
098: * <p>
099: * attribute is between 0 and getNumAttributes()
100: * </p>
101: *
102: * @param coordinate the coordinate to be modified
103: * @param attribute between 0 and getNumAttributes()
104: * @param value
105: */
106: void setAttribute(int coordinate, int attribute, Object value);
107:
108: /**
109: * Retrive ordinates as an array.
110: *
111: * <p>
112: * Example: (x,y) getDimension()==2<br>
113: * This is defined for the number of dimensions. If the other attributes
114: * happen to be a double, they can still be accessed by using an ordinate
115: * value geater than getDimension().
116: * </p>
117: *
118: * <ul>
119: * <li>
120: * ordinate 0: x ordinate
121: * </li>
122: * <li>
123: * ordinate 1: y ordinate
124: * </li>
125: * <li>
126: * ordinate 2: m attribute
127: * </li>
128: * <li>
129: * ordinate 3: g attribute
130: * </li>
131: * </ul>
132: *
133: *
134: * @param ordinate Ordinate to retrieve. ordinate is less than <br>
135: * getDimension()+getMeasures() if the measures are doubles as
136: * well. Otherwise<br>
137: * ordinate is less than getDimensions().
138: *
139: * @return ordinate array
140: */
141: double[] toOrdinateArray(int ordinate);
142:
143: /**
144: * toAttributeArray purpose.
145: *
146: * <p>
147: * Description ...
148: * </p>
149: *
150: * @param attribute Between 0 and getNumAttrributes()
151: *
152: * @return an array of attributes
153: */
154: Object[] toAttributeArray(int attribute);
155:
156: /**
157: * Supplies an array of ordiantes.
158: *
159: * <p>
160: * The ordinateArray should be the same length as the CoordinateSequence.<br>
161: * ordinate should be between 0 and getDimension().<br>
162: * If the attributes are doubles as well, then ordinate can be as great as<br>
163: * getDimension() + getNumAttributes().
164: * </p>
165: */
166: void setOrdinateArray(int ordinate, double[] ordinateArray);
167:
168: /**
169: * setAttributeArray purpose.
170: *
171: * <p>
172: * Description ...
173: * </p>
174: *
175: * @param attribute between 0 and getNumAttributes()
176: * @param attributeArray May be an object or primative array
177: */
178: void setAttributeArray(int attribute, Object attributeArray);
179:
180: /**
181: * Retrieve ordinate information (an array of ordinates for each
182: * coordinate).
183: *
184: * <p>
185: * Example: (x,y,m,g) getDimension()==2, getNumAttributes()==2
186: * </p>
187: * <pre><code>
188: * [ [ x1, x2,...,xN], [ y1, y2,...,yN] ]
189: * </code></pre>
190: *
191: * @return column major ordinate arrays (these are spatially significant)
192: */
193: double[][] toOrdinateArrays();
194:
195: /**
196: * Retrieve Attribute information (an array of attributes for each
197: * coordiante).
198: *
199: * <p>
200: * Example: (x,y,m,g) getDimension()==2, getAttributes()==2
201: * </p>
202: * <pre><code>
203: * [ [ m1, m2,...,mN], [ g1, g2,..., gN] ]
204: * </code></pre>
205: *
206: * <p></p>
207: *
208: * @return Attribute Arrays, may be object or primative arrays
209: */
210: Object[] toAttributeArrays();
211:
212: /**
213: * Completely replace sequence with the provided information.
214: *
215: * <p>
216: * Example: (x,y,m,g) getDimension()==2, getNumAttributes()==2
217: * </p>
218: * <pre><code>
219: * <b>dimensions</b>:[ [ x1, x2,...,xN], [ y1, y2,...,yN] ]
220: * <b>attributes</b>:[ [ m1, m2,...,mN], [ g1, g2,..., gN] ]
221: * </code></pre>
222: *
223: * @param ordinateArrays dimensions column major ordinate arrays
224: * (these are spatially significant)
225: * @param attributeArrays Indiviual attribute arrays may be primative or
226: * object arrays
227: */
228: void setCoordinateArrays(double[][] ordinateArrays,
229: Object[] attributeArrays);
230:
231: /**
232: * Allows modification of a single coordinate (including attribute values).
233: *
234: * <p>
235: * Normal Use: where D is getDimensions() and N is getNumAttributes():
236: * </p>
237: * <pre><code>
238: * <b>dimensions</b>: [ ordX, ordY, ..., ordD ]
239: * <b>attributes</b>: [ atr1, atr2, ...., atrN ]
240: * </code></pre>
241: *
242: * <p>
243: * When dealing with attributes that are all double values the ordinates
244: * array may be used to set both ordinates and attribute values.
245: * </p>
246: *
247: * <p>
248: * Optimized Use: where D is getDimensions() and N is getNumAttributes():
249: * </p>
250: * <pre><code>
251: * <b>dimensions</b>: [ ordX, ordY, ..., ordD, atr1, atr2, ... attrN ]
252: * <b>attributes</b>: null
253: * </code></pre>
254: *
255: * <p></p>
256: *
257: * @param coordinate index of coordiante to be modified
258: * @param ordinates array ordinate values (may be extended with attribute
259: * values)
260: * @param attributes array of attribute values, or null is ordinates has
261: * been extended
262: */
263: void setAt(int coordinate, double[] ordinates, Object[] attributes);
264: }
|