C# Класс TestShapeFile.ShapeDisplay

ShapeDisplay is a helper class for importing ESRI shapefiles and creating/displaying shapes on a WPF canvas. During the import step, a progress window is displayed. This is implemented using the WPF single-threaded programming model, which allows tasks to be executed by a Dispatcher instance while keeping the UI responsive.
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
Geos List

Открытые методы

Метод Описание
CancelReadShapeFile ( ) : void

Request the current shapefile read operation to be cancelled.

Pan ( double factorX, double factorY ) : void

Perform a panning operation given X and Y factor values which can be thought of as a fraction of the canvas actual width or height.

ReadShapeFile ( string fileName ) : void

Read shapes and attributes from the given shapefile.

ResetCanvas ( ) : void

Reset the canvas.

SaveToXaml ( Stream stream ) : void

Save the owner object (the main window) to XAML. This method may take a long time to run if there are many objects on the canvas (shapefile > 1 Mb).

ShapeDisplay ( Window owner, System.Windows.Controls.Canvas canvas ) : ESRI.ArcGIS.Client

Constructor for the ShapeDisplay class.

ShapeDisplay ( Window owner, GraphicsLayer layer ) : ESRI.ArcGIS.Client

Constructor for the ShapeDisplay class.

Zoom ( double zoomFactor ) : void

Perform a zoom operation about the current center of the canvas.

Приватные методы

Метод Описание
CreatePathGeometry ( ShapeFileRecord record ) : System.Windows.Media.Geometry

Create a PathGeometry given a shapefile record.

CreateShapeBrushes ( double gradientFactor, double gradientAngle ) : void

Create a set of linear gradient brushes which we can use as a random pool for assignment to WPF shapes. A higher gradient factor results in a stronger gradient effect.

CreateShapeTransform ( ShapeFileReadInfo info ) : System.Windows.Media.TransformGroup

Computes a transformation so that the shapefile geometry will maximize the available space on the canvas and be perfectly centered as well.

CreateStreamGeometry ( ShapeFileRecord record ) : System.Windows.Media.Geometry

Create a StreamGeometry given a shapefile record.

CreateWPFPoint ( string shapeName, ShapeFileRecord record ) : System.Windows.Shapes.Shape

Create a WPF shape to represent a shapefile point or multipoint record.

CreateWPFShape ( string shapeName, ShapeFileRecord record ) : System.Windows.Shapes.Shape

Create a WPF shape given a shapefile record.

DisplayLonLatCoord ( Point canvasPosition ) : void

Given a canvas position, display the corresponding lon/lat coordinates on the canvas.

DisplayLonLatDefault ( ) : void

Display some default text in the lon/lat label.

DisplayNextShapeRecord ( ShapeFileReadInfo info ) : void

Display a block of shape records as WPF shapes, and schedule the next display with the dispatcher if needed.

DisplayShapes ( ShapeFileReadInfo info ) : void

Begin creating and displaying WPF shapes on the canvas.

EndReadShapeFile ( ) : void

Perform some cleanup at the end of reading a shapefile.

EndReadShapeFile ( ShapeFileReadInfo info ) : void

Perform some cleanup at the end of reading a shapefile.

GetAdjustedColor ( Color inColor, double factor ) : Color

Given an input color, return an adjusted color using a factor value which ranges from 0 to 1. The larger the factor, the lighter the adjusted color. A factor of 0 means no adjustment to the input color.

Note that the alpha component of the input color is not adjusted.

GetLonLatCoordinates ( Point canvasPosition ) : Point

Given a canvas position, convert it to a longitude and latitude coordinate.

GetLonLatDisplayText ( Point lonLat ) : string

Given a lon/lat coordinate, determine the corresponding display text.

GetRandomShapeBrush ( ) : System.Windows.Media.Brush

Get the next brush that can be used to fill a WPF shape.

HideProgress ( ) : void

Hide the progress window.

ReadDbaseAttributes ( ShapeFileReadInfo info ) : void

Read dBASE file attributes.

ReadNextShapeRecord ( ShapeFileReadInfo info ) : void

Read a block of shape file records and possibly schedule the next read with the dispatcher.

ShowProgress ( string progressText, double progressValue ) : void

Show the progress window with the given progress value.

canvas_MouseDown ( object sender, System.Windows.Input.MouseButtonEventArgs e ) : void

Handle the MouseDown event for the canvas.

canvas_MouseEnter ( object sender, System.Windows.Input.MouseEventArgs e ) : void

Handle the MouseEnter event for the canvas.

canvas_MouseLeave ( object sender, System.Windows.Input.MouseEventArgs e ) : void

Handle the MouseLeave event for the canvas.

canvas_MouseMove ( object sender, System.Windows.Input.MouseEventArgs e ) : void

Handle the MouseMove event for the canvas.

canvas_MouseUp ( object sender, System.Windows.Input.MouseButtonEventArgs e ) : void

Handle the MouseUp event for the canvas.

progressWindow_Cancel ( object sender, CancelEventArgs e ) : void

Handle the Cancel button being pressed in the progress window.

progressWindow_Closed ( object sender, EventArgs e ) : void

Handle closing of the progress window.

Описание методов

CancelReadShapeFile() публичный Метод

Request the current shapefile read operation to be cancelled.
public CancelReadShapeFile ( ) : void
Результат void

Pan() публичный Метод

Perform a panning operation given X and Y factor values which can be thought of as a fraction of the canvas actual width or height.
public Pan ( double factorX, double factorY ) : void
factorX double Fraction of canvas actual width to pan horizontally.
factorY double Fraction of canvas actual height to pan vertically.
Результат void

ReadShapeFile() публичный Метод

Read shapes and attributes from the given shapefile.
public ReadShapeFile ( string fileName ) : void
fileName string Full pathname of a shapefile.
Результат void

ResetCanvas() публичный Метод

Reset the canvas.
public ResetCanvas ( ) : void
Результат void

SaveToXaml() публичный Метод

Save the owner object (the main window) to XAML. This method may take a long time to run if there are many objects on the canvas (shapefile > 1 Mb).
public SaveToXaml ( Stream stream ) : void
stream Stream Output stream for writing the XAML.
Результат void

ShapeDisplay() публичный Метод

Constructor for the ShapeDisplay class.
public ShapeDisplay ( Window owner, System.Windows.Controls.Canvas canvas ) : ESRI.ArcGIS.Client
owner System.Windows.Window Window that acts as an owner to child windows.
canvas System.Windows.Controls.Canvas The canvas on which to create WPF shapes.
Результат ESRI.ArcGIS.Client

ShapeDisplay() публичный Метод

Constructor for the ShapeDisplay class.
public ShapeDisplay ( Window owner, GraphicsLayer layer ) : ESRI.ArcGIS.Client
owner System.Windows.Window Window that acts as an owner to child windows.
layer GraphicsLayer
Результат ESRI.ArcGIS.Client

Zoom() публичный Метод

Perform a zoom operation about the current center of the canvas.
public Zoom ( double zoomFactor ) : void
zoomFactor double Zoom multiplication factor (1, 2, 4, etc).
Результат void

Описание свойств

Geos публичное свойство

public List Geos
Результат List