Presentation is loading. Please wait.

Presentation is loading. Please wait.

GTECH 731 Lab Session 8 10/26/10 Lab 7 Geotools. Previous Labs Labs designed to gradually introduce C# and Visual Studio Started with simple, straight.

Similar presentations


Presentation on theme: "GTECH 731 Lab Session 8 10/26/10 Lab 7 Geotools. Previous Labs Labs designed to gradually introduce C# and Visual Studio Started with simple, straight."— Presentation transcript:

1 GTECH 731 Lab Session 8 10/26/10 Lab 7 Geotools

2 Previous Labs Labs designed to gradually introduce C# and Visual Studio Started with simple, straight forward procedural programs with “literal” values that executed statements from start to finish i.e., “Hello world” and calculation converting “feet” to “meters” Added variable to code making calculation more flexible i.e., converting feet to meters Took user input and assigned it to variable Take in name and say hello Used boolean operations to direct control of program User choice determined unit to convert from feet All procedural programming Flow of logic beginning to end Variables separate from procedures that operated on them

3 Lab 6 – Object Oriented Programming Data and functionality are combined into self-contained entity – Object Objects “know” what they “are” and what they “can do” Type of object defined with set of hierarchical classes State of object defined by member variables Inherited from higher level, parent class Local, unique more specific to child class Aggregation of other objects Functionality of object defined methods Could inherit methods from higher level, parent class Override methods from higher level with locally defined version Unique methods at lower levels not available in parent class Object is instance of Class making methods and variables available Class is definition of an object: “Honda Civic” defines particular vehicle Object is instance of class: “My Car” is an instance of Honda Civic

4 Lab 6 – Simple Geometry Class Library You created simple, stand-alone Geometry Class Library Geometry sName Virtual Draw() Virtual Length() Point : Geometry X,Y variables Override Draw() Line : Geometry Aggregation of 2 Point objects Start and End Override Draw() Override Length() LineString : Geometry Aggregated list of Point objects Override Draw() Override Length()

5 Lab 7 – Geotools Geometry Class Library Geotools is Urban Science Applications, Inc.’s answer to your Geometry class library More extensive and works differently than your library Many attributes beyond simple X,Y coordinates Spatial reference, Precision Model, Envelope, GeometryFactory Extensive set of predefined Geometry classes Coordinate, Coordinates, Point, LineString, Polygon etc. Predefined Operation classes Buffer, Distance, Overlay etc. Predefined Algorithm classes ConvexHull, LineIntersector, PointLocator, SimplePointInring etc.

6 Lab 7 – Geotools “State” definition of Geometry, Coordinate and Point classes public abstract class Geometry : IGeometry, IComparable { protected static CGAlgorithms _cgAlgorithms = new RobustCGAlgorithms(); protected PrecisionModel _precisionModel; protected int _SRID;//spatial reference id protected Envelope _envelope; protected GeometryFactory _geometryFactory; protected string[] _sortedClasses = new string[]{"Point", "MultiPoint", "LineString“, "LinearRing", "MultiLineString", "Polygon", "MultiPolygon", "GeometryCollection" }; InternalGeometryComponentFilter _geometryChangedFilter = new InternalGeometryComponentFilter(); public class Point : Geometry, IPoint { protected Coordinate _coordinate; #region Properties public double X { get { return _coordinate.X; } public double Y { get { return _coordinate.Y; } #endregion public class Coordinate : IComparable, ICloneable { private double _x=0.0; private double _y=0.0; private double _z=Double.NaN;

7 Lab 7 – Geotools Predefined code available for use in any project Compiled in a Dynamic Link Library (.DLL file) Non-executable on its own Provides state of Geometric objects and many useful functions Use Geotools to hold state of objects in custom Geometry library Provides some familiar methods such as “GetLength” Need provide other methods such as “Draw” Geotools uses concept of “Factory” “GeometryFactory” object to create Geometry objects Used to Instantiate objects instead of “new” keyword Initializes them to a desired state including spatial reference, precision etc. Provides foundation for Simple Feature Spec Part of Open Geospatial Consortium standards (www.opengeospatial.org)www.opengeospatial.org

8 Lab 7 – Geotools Implementation (Partial?) of Simple Feature Spec ?? ?? ?

9 Lab 7 – Geotools Class Definition Headers Point MultiPoint LineSegment LineString LinearRing MultiLineString Polygon MultiPolygon GeometryCollection public class LineString : Geometry, ILineString { protected Coordinates _points; public class Point : Geometry, IPoint { protected Coordinate _coordinate; public class MultiPoint : GeometryCollection, IMultiPoint public class LinearRing : LineString, ILinearRing public class MultiLineString : GeometryCollection, IMultiLineString public class Polygon : Geometry, IPolygon { protected LinearRing _shell = null; protected LinearRing[] _holes; public class MultiPolygon : GeometryCollection, IMultiPolygon public class GeometryCollection :Geometry, IGeometryCollection, IEnumerable internal class LineSegment : IComparable { protected Coordinate _p0; protected Coordinate _p1;

10 Lab 7 – Geotools Spatial Reference? Curve, MultiCurve, Surface, MultiSurface? Must be custom defined by developer? Provided somewhere else in Geotools? public abstract class Geometry : IGeometry, IComparable { protected static CGAlgorithms _cgAlgorithms = new RobustCGAlgorithms(); protected PrecisionModel _precisionModel; protected int _SRID;//spatial reference id protected Envelope _envelope; protected GeometryFactory _geometryFactory; protected string[] _sortedClasses = new string[]{"Point", "MultiPoint", "LineString“, "LinearRing", "MultiLineString", "Polygon", "MultiPolygon", "GeometryCollection" }; InternalGeometryComponentFilter _geometryChangedFilter = new InternalGeometryComponentFilter();

11 Lab 7 – Geotools Summary Extensive class library Geometry objects Holds state of Geometric objects and many functions Predefined Geometries, Operations and Algorithms “GeometryFactory” to Instantiate objects Spatial reference and precision Provides foundation for Simple Feature Spec Code available in a Dynamic Link Library (.DLL file)

12 Lab 7 – Geotools Lab Overview


Download ppt "GTECH 731 Lab Session 8 10/26/10 Lab 7 Geotools. Previous Labs Labs designed to gradually introduce C# and Visual Studio Started with simple, straight."

Similar presentations


Ads by Google