Merge all changes from the naturaldocs sandbox. This brings all the work that

has been done in the NaturalDocs branch back to trunk. Thanks to everyone who
helped out in making this happen. (I could list people, but the list would
be long, and I'm already mentally on vacation.)


git-svn-id: http://svn.openlayers.org/trunk/openlayers@3545 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2007-06-29 15:59:20 +00:00
parent f1c61fd0d6
commit 3948913bfc
107 changed files with 8658 additions and 4011 deletions
+113
View File
@@ -0,0 +1,113 @@
Format: 1.35
# This is the Natural Docs languages file for this project. If you change
# anything here, it will apply to THIS PROJECT ONLY. If you'd like to change
# something for all your projects, edit the Languages.txt in Natural Docs'
# Config directory instead.
# You can prevent certain file extensions from being scanned like this:
# Ignore Extensions: [extension] [extension] ...
#-------------------------------------------------------------------------------
# SYNTAX:
#
# Unlike other Natural Docs configuration files, in this file all comments
# MUST be alone on a line. Some languages deal with the # character, so you
# cannot put comments on the same line as content.
#
# Also, all lists are separated with spaces, not commas, again because some
# languages may need to use them.
#
# Language: [name]
# Alter Language: [name]
# Defines a new language or alters an existing one. Its name can use any
# characters. If any of the properties below have an add/replace form, you
# must use that when using Alter Language.
#
# The language Shebang Script is special. It's entry is only used for
# extensions, and files with those extensions have their shebang (#!) lines
# read to determine the real language of the file. Extensionless files are
# always treated this way.
#
# The language Text File is also special. It's treated as one big comment
# so you can put Natural Docs content in them without special symbols. Also,
# if you don't specify a package separator, ignored prefixes, or enum value
# behavior, it will copy those settings from the language that is used most
# in the source tree.
#
# Extensions: [extension] [extension] ...
# [Add/Replace] Extensions: [extension] [extension] ...
# Defines the file extensions of the language's source files. You can
# redefine extensions found in the main languages file. You can use * to
# mean any undefined extension.
#
# Shebang Strings: [string] [string] ...
# [Add/Replace] Shebang Strings: [string] [string] ...
# Defines a list of strings that can appear in the shebang (#!) line to
# designate that it's part of the language. You can redefine strings found
# in the main languages file.
#
# Ignore Prefixes in Index: [prefix] [prefix] ...
# [Add/Replace] Ignored Prefixes in Index: [prefix] [prefix] ...
#
# Ignore [Topic Type] Prefixes in Index: [prefix] [prefix] ...
# [Add/Replace] Ignored [Topic Type] Prefixes in Index: [prefix] [prefix] ...
# Specifies prefixes that should be ignored when sorting symbols in an
# index. Can be specified in general or for a specific topic type.
#
#------------------------------------------------------------------------------
# For basic language support only:
#
# Line Comments: [symbol] [symbol] ...
# Defines a space-separated list of symbols that are used for line comments,
# if any.
#
# Block Comments: [opening sym] [closing sym] [opening sym] [closing sym] ...
# Defines a space-separated list of symbol pairs that are used for block
# comments, if any.
#
# Package Separator: [symbol]
# Defines the default package separator symbol. The default is a dot.
#
# [Topic Type] Prototype Enders: [symbol] [symbol] ...
# When defined, Natural Docs will attempt to get a prototype from the code
# immediately following the topic type. It stops when it reaches one of
# these symbols. Use \n for line breaks.
#
# Line Extender: [symbol]
# Defines the symbol that allows a prototype to span multiple lines if
# normally a line break would end it.
#
# Enum Values: [global|under type|under parent]
# Defines how enum values are referenced. The default is global.
# global - Values are always global, referenced as 'value'.
# under type - Values are under the enum type, referenced as
# 'package.enum.value'.
# under parent - Values are under the enum's parent, referenced as
# 'package.value'.
#
# Perl Package: [perl package]
# Specifies the Perl package used to fine-tune the language behavior in ways
# too complex to do in this file.
#
#------------------------------------------------------------------------------
# For full language support only:
#
# Full Language Support: [perl package]
# Specifies the Perl package that has the parsing routines necessary for full
# language support.
#
#-------------------------------------------------------------------------------
# The following languages are defined in the main file, if you'd like to alter
# them:
#
# Text File, Shebang Script, C/C++, C#, Java, JavaScript, Perl, Python,
# PHP, SQL, Visual Basic, Pascal, Assembly, Ada, Tcl, Ruby, Makefile,
# ActionScript, ColdFusion, R, Fortran
# If you add a language that you think would be useful to other developers
# and should be included in Natural Docs by default, please e-mail it to
# languages [at] naturaldocs [dot] org.
+177
View File
@@ -0,0 +1,177 @@
Format: 1.35
Title: OpenLayers
SubTitle: JavaScript Mapping Library
# You can add a footer to your documentation like this:
# Footer: [text]
# If you want to add a copyright notice, this would be the place to do it.
# --------------------------------------------------------------------------
#
# Cut and paste the lines below to change the order in which your files
# appear on the menu. Don't worry about adding or removing files, Natural
# Docs will take care of that.
#
# You can further organize the menu by grouping the entries. Add a
# "Group: [name] {" line to start a group, and add a "}" to end it.
#
# You can add text and web links to the menu by adding "Text: [text]" and
# "Link: [name] ([URL])" lines, respectively.
#
# The formatting and comments are auto-generated, so don't worry about
# neatness when editing the file. Natural Docs will clean it up the next
# time it is run. When working with groups, just deal with the braces and
# forget about the indentation and comments.
#
# --------------------------------------------------------------------------
File: OpenLayers (OpenLayers.js)
Group: OpenLayers {
File: Ajax (no auto-title, OpenLayers/Ajax.js)
File: Base Types (no auto-title, OpenLayers/BaseTypes.js)
File: Console (no auto-title, OpenLayers/Console.js)
Group: Control {
File: Control (no auto-title, OpenLayers/Control.js)
File: ArgParser (no auto-title, OpenLayers/Control/ArgParser.js)
File: ZoomToMaxExtent (no auto-title, OpenLayers/Control/ZoomToMaxExtent.js)
File: OverviewMap (no auto-title, OpenLayers/Control/OverviewMap.js)
File: DragPan (no auto-title, OpenLayers/Control/DragPan.js)
File: DrawFeature (no auto-title, OpenLayers/Control/DrawFeature.js)
File: EditingToolbar (no auto-title, OpenLayers/Control/EditingToolbar.js)
File: KeyboardDefaults (no auto-title, OpenLayers/Control/KeyboardDefaults.js)
File: LayerSwitcher (no auto-title, OpenLayers/Control/LayerSwitcher.js)
File: MouseDefaults (no auto-title, OpenLayers/Control/MouseDefaults.js)
File: MousePosition (no auto-title, OpenLayers/Control/MousePosition.js)
File: MouseToolbar (no auto-title, OpenLayers/Control/MouseToolbar.js)
File: Navigation (no auto-title, OpenLayers/Control/Navigation.js)
File: NavToolbar (no auto-title, OpenLayers/Control/NavToolbar.js)
File: Panel (no auto-title, OpenLayers/Control/Panel.js)
File: PanZoomBar (no auto-title, OpenLayers/Control/PanZoomBar.js)
File: Permalink (no auto-title, OpenLayers/Control/Permalink.js)
File: Scale (no auto-title, OpenLayers/Control/Scale.js)
File: SelectFeature (no auto-title, OpenLayers/Control/SelectFeature.js)
File: ZoomBox (no auto-title, OpenLayers/Control/ZoomBox.js)
File: PanZoom (OpenLayers/Control/PanZoom.js)
} # Group: Control
File: Events (no auto-title, OpenLayers/Events.js)
Group: Feature {
File: Feature (no auto-title, OpenLayers/Feature.js)
File: WFS (no auto-title, OpenLayers/Feature/WFS.js)
File: Vector (no auto-title, OpenLayers/Feature/Vector.js)
} # Group: Feature
Group: Format {
File: Format (no auto-title, OpenLayers/Format.js)
File: GeoRSS (OpenLayers/Format/GeoRSS.js)
File: GML (OpenLayers/Format/GML.js)
File: KML (OpenLayers/Format/KML.js)
File: WFS (OpenLayers/Format/WFS.js)
File: WKT (no auto-title, OpenLayers/Format/WKT.js)
} # Group: Format
Group: Geometry {
File: Geometry (no auto-title, OpenLayers/Geometry.js)
File: Collection (no auto-title, OpenLayers/Geometry/Collection.js)
File: Curve (OpenLayers/Geometry/Curve.js)
File: LinearRing (OpenLayers/Geometry/LinearRing.js)
File: LineString (no auto-title, OpenLayers/Geometry/LineString.js)
File: MultiLineString (no auto-title, OpenLayers/Geometry/MultiLineString.js)
File: MultiPoint (no auto-title, OpenLayers/Geometry/MultiPoint.js)
File: MultiPolygon (no auto-title, OpenLayers/Geometry/MultiPolygon.js)
File: Point (no auto-title, OpenLayers/Geometry/Point.js)
File: Polygon (no auto-title, OpenLayers/Geometry/Polygon.js)
File: Rectangle (OpenLayers/Geometry/Rectangle.js)
File: Surface (OpenLayers/Geometry/Surface.js)
} # Group: Geometry
Group: Handler {
File: Handler (no auto-title, OpenLayers/Handler.js)
File: Box (OpenLayers/Handler/Box.js)
File: Drag (no auto-title, OpenLayers/Handler/Drag.js)
File: Feature (no auto-title, OpenLayers/Handler/Feature.js)
File: Keyboard (no auto-title, OpenLayers/Handler/Keyboard.js)
File: MouseWheel (no auto-title, OpenLayers/Handler/MouseWheel.js)
File: Path (no auto-title, OpenLayers/Handler/Path.js)
File: Point (no auto-title, OpenLayers/Handler/Point.js)
File: Polygon (OpenLayers/Handler/Polygon.js)
} # Group: Handler
File: Icon (no auto-title, OpenLayers/Icon.js)
Group: Layer {
File: Layer (no auto-title, OpenLayers/Layer.js)
File: Boxes (OpenLayers/Layer/Boxes.js)
File: EventPane (OpenLayers/Layer/EventPane.js)
File: FixedZoomLevels (OpenLayers/Layer/FixedZoomLevels.js)
File: GeoRSS (no auto-title, OpenLayers/Layer/GeoRSS.js)
File: GML (no auto-title, OpenLayers/Layer/GML.js)
File: Grid (OpenLayers/Layer/Grid.js)
File: Image (no auto-title, OpenLayers/Layer/Image.js)
File: MapServer (OpenLayers/Layer/MapServer.js)
File: Markers (no auto-title, OpenLayers/Layer/Markers.js)
File: Text (OpenLayers/Layer/Text.js)
File: Vector (no auto-title, OpenLayers/Layer/Vector.js)
File: WMS (no auto-title, OpenLayers/Layer/WMS.js)
File: WMS.Untiled (no auto-title, OpenLayers/Layer/WMS/Untiled.js)
File: WorldWind (OpenLayers/Layer/WorldWind.js)
} # Group: Layer
File: Map (no auto-title, OpenLayers/Map.js)
Group: Marker {
File: Marker (no auto-title, OpenLayers/Marker.js)
File: Box (no auto-title, OpenLayers/Marker/Box.js)
} # Group: Marker
Group: Popup {
File: Popup (no auto-title, OpenLayers/Popup.js)
File: Anchored (no auto-title, OpenLayers/Popup/Anchored.js)
File: AnchoredBubble (OpenLayers/Popup/AnchoredBubble.js)
} # Group: Popup
Group: Renderer {
File: Renderer (OpenLayers/Renderer.js)
File: Elements (no auto-title, OpenLayers/Renderer/Elements.js)
File: SVG (no auto-title, OpenLayers/Renderer/SVG.js)
File: VML (no auto-title, OpenLayers/Renderer/VML.js)
} # Group: Renderer
Group: Tile {
File: Tile (no auto-title, OpenLayers/Tile.js)
File: Image (no auto-title, OpenLayers/Tile/Image.js)
File: WFS (no auto-title, OpenLayers/Tile/WFS.js)
} # Group: Tile
File: Util (OpenLayers/Util.js)
} # Group: OpenLayers
Group: Index {
Index: Everything
Class Index: Classes
Constant Index: Constants
Function Index: Functions
Property Index: Properties
File Index: Files
Constructor Index: Constructor
} # Group: Index
+20
View File
@@ -0,0 +1,20 @@
p {
text-indent: 0; margin-bottom: 1em;
}
.MGroup {
font-variant: normal;
margin: 0.4em 0 0em 10px
}
.MTitle {
font-variant: normal;
}
.CGroup .CTitle {
font-variant: normal;
}
.SGroup .SEntry {
font-variant: normal;
}
+108
View File
@@ -0,0 +1,108 @@
Format: 1.35
# This is the Natural Docs topics file for this project. If you change anything
# here, it will apply to THIS PROJECT ONLY. If you'd like to change something
# for all your projects, edit the Topics.txt in Natural Docs' Config directory
# instead.
Ignore Keywords:
function, functions
func, funcs
procedure, procedures
proc, procs
routine, routines
subroutine, subroutines
sub, subs
method, methods
callback, callbacks
property, properties
prop, props
#-------------------------------------------------------------------------------
# SYNTAX:
#
# Topic Type: [name]
# Alter Topic Type: [name]
# Creates a new topic type or alters one from the main file. Each type gets
# its own index and behavior settings. Its name can have letters, numbers,
# spaces, and these charaters: - / . '
#
# Plural: [name]
# Sets the plural name of the topic type, if different.
#
# Keywords:
# [keyword]
# [keyword], [plural keyword]
# ...
# Defines or adds to the list of keywords for the topic type. They may only
# contain letters, numbers, and spaces and are not case sensitive. Plural
# keywords are used for list topics. You can redefine keywords found in the
# main topics file.
#
# Index: [yes|no]
# Whether the topics get their own index. Defaults to yes. Everything is
# included in the general index regardless of this setting.
#
# Scope: [normal|start|end|always global]
# How the topics affects scope. Defaults to normal.
# normal - Topics stay within the current scope.
# start - Topics start a new scope for all the topics beneath it,
# like class topics.
# end - Topics reset the scope back to global for all the topics
# beneath it.
# always global - Topics are defined as global, but do not change the scope
# for any other topics.
#
# Class Hierarchy: [yes|no]
# Whether the topics are part of the class hierarchy. Defaults to no.
#
# Variable Type: [yes|no]
# Whether the topics can be a variable type. Defaults to no.
#
# Page Title If First: [yes|no]
# Whether the topic's title becomes the page title if it's the first one in
# a file. Defaults to no.
#
# Break Lists: [yes|no]
# Whether list topics should be broken into individual topics in the output.
# Defaults to no.
#
# Can Group With: [type], [type], ...
# Defines a list of topic types that this one can possibly be grouped with.
# Defaults to none.
#-------------------------------------------------------------------------------
# The following topics are defined in the main file, if you'd like to alter
# their behavior or add keywords:
#
# Generic, Class, Interface, Section, File, Group, Function, Variable,
# Property, Type, Constant, Enumeration, Event, Delegate, Macro,
# Database, Database Table, Database View, Database Index, Database
# Cursor, Database Trigger, Cookie, Build Target
# If you add something that you think would be useful to other developers
# and should be included in Natural Docs by default, please e-mail it to
# topics [at] naturaldocs [dot] org.
Topic Type: Constructor
Class Hierarchy: Yes
Keywords:
constructor
initialize
Alter Topic Type: Function
Add Keywords:
apimethod
apifunction
Alter Topic Type: Property
Add Keywords:
apiproperty
+25 -25
View File
@@ -1,25 +1,25 @@
OpenLayers contributors: OpenLayers contributors:
Howard Butler Howard Butler
Bertil Chaupis Bertil Chaupis
John Cole John Cole
Jeff Dege Jeff Dege
Schuyler Erle Schuyler Erle
Christian López Espínola Christian López Espínola
John Frank John Frank
Sean Gilles Sean Gilles
Pierre Giraud Pierre Giraud
Andreas Hocevar Andreas Hocevar
Philip Lindsay Philip Lindsay
Corey Puffault Corey Puffault
Tim Schaub Tim Schaub
Christopher Schmidt Christopher Schmidt
Cameron Shorter Cameron Shorter
Paul Spencer Paul Spencer
James Stembridge James Stembridge
Erik Uzureau Erik Uzureau
Bill Woodall Bill Woodall
Steve Woodbridge Steve Woodbridge
OpenLayers is graciously supported by MetaCarta, Inc. OpenLayers is graciously supported by MetaCarta, Inc.
<http://www.metacarta.com>. <http://www.metacarta.com>.
+49 -49
View File
@@ -1,49 +1,49 @@
Customizing OpenLayers Customizing OpenLayers
====================== ======================
OpenLayers is designed to fit many needs -- fitting in alongside all kinds of OpenLayers is designed to fit many needs -- fitting in alongside all kinds of
various applications which are currently in use. various applications which are currently in use.
Currently, OpenLayers supports a 'theme' option when creating a map. This Currently, OpenLayers supports a 'theme' option when creating a map. This
theme option allows you to specify the location of a CSS theme which should theme option allows you to specify the location of a CSS theme which should
be included. be included.
A default theme is available as an example in the theme/ directory: the setup A default theme is available as an example in the theme/ directory: the setup
is: is:
* theme/ * theme/
* theme/default/ * theme/default/
* theme/default/style.css * theme/default/style.css
* theme/default/img/ * theme/default/img/
Currently, the OpenLayers code does not support class names, and therefore, Currently, the OpenLayers code does not support class names, and therefore,
it is not possible to control many aspects of OpenLayers code with CSS it is not possible to control many aspects of OpenLayers code with CSS
classes. However, with this framework in place, we expect to invest time classes. However, with this framework in place, we expect to invest time
to make existing features and new features use the CSS theming framework to make existing features and new features use the CSS theming framework
where apropriate. where apropriate.
Class Naming Class Naming
============ ============
Elements should have class names which are descriptive of the Javascript Elements should have class names which are descriptive of the Javascript
class from which they come. For example, the main layer switcher element class from which they come. For example, the main layer switcher element
in the OpenLayers.Control.LayerSwitcher would be classed: in the OpenLayers.Control.LayerSwitcher would be classed:
olControlLayerSwitcher olControlLayerSwitcher
This would allow users to add to their style.css class in their theme, This would allow users to add to their style.css class in their theme,
changing, for example: changing, for example:
:: ::
.olControlLayerSwitcher input { .olControlLayerSwitcher input {
width:10px; width:10px;
} }
Sub elements of a particular control can add to the class name: Sub elements of a particular control can add to the class name:
:: ::
.olControlLayerSwitcherBaseLabel { .olControlLayerSwitcherBaseLabel {
color: red; color: red;
} }
+3 -3
View File
@@ -1,3 +1,3 @@
Automatically generated OpenLayers API documentation is online: Automatically generated OpenLayers API documentation is online:
http://dev.openlayers.org/docs/overview-tree.html http://dev.openlayers.org/docs/overview-tree.html
+113
View File
@@ -0,0 +1,113 @@
Format: 1.35
# This is the Natural Docs languages file for this project. If you change
# anything here, it will apply to THIS PROJECT ONLY. If you'd like to change
# something for all your projects, edit the Languages.txt in Natural Docs'
# Config directory instead.
# You can prevent certain file extensions from being scanned like this:
# Ignore Extensions: [extension] [extension] ...
#-------------------------------------------------------------------------------
# SYNTAX:
#
# Unlike other Natural Docs configuration files, in this file all comments
# MUST be alone on a line. Some languages deal with the # character, so you
# cannot put comments on the same line as content.
#
# Also, all lists are separated with spaces, not commas, again because some
# languages may need to use them.
#
# Language: [name]
# Alter Language: [name]
# Defines a new language or alters an existing one. Its name can use any
# characters. If any of the properties below have an add/replace form, you
# must use that when using Alter Language.
#
# The language Shebang Script is special. It's entry is only used for
# extensions, and files with those extensions have their shebang (#!) lines
# read to determine the real language of the file. Extensionless files are
# always treated this way.
#
# The language Text File is also special. It's treated as one big comment
# so you can put Natural Docs content in them without special symbols. Also,
# if you don't specify a package separator, ignored prefixes, or enum value
# behavior, it will copy those settings from the language that is used most
# in the source tree.
#
# Extensions: [extension] [extension] ...
# [Add/Replace] Extensions: [extension] [extension] ...
# Defines the file extensions of the language's source files. You can
# redefine extensions found in the main languages file. You can use * to
# mean any undefined extension.
#
# Shebang Strings: [string] [string] ...
# [Add/Replace] Shebang Strings: [string] [string] ...
# Defines a list of strings that can appear in the shebang (#!) line to
# designate that it's part of the language. You can redefine strings found
# in the main languages file.
#
# Ignore Prefixes in Index: [prefix] [prefix] ...
# [Add/Replace] Ignored Prefixes in Index: [prefix] [prefix] ...
#
# Ignore [Topic Type] Prefixes in Index: [prefix] [prefix] ...
# [Add/Replace] Ignored [Topic Type] Prefixes in Index: [prefix] [prefix] ...
# Specifies prefixes that should be ignored when sorting symbols in an
# index. Can be specified in general or for a specific topic type.
#
#------------------------------------------------------------------------------
# For basic language support only:
#
# Line Comments: [symbol] [symbol] ...
# Defines a space-separated list of symbols that are used for line comments,
# if any.
#
# Block Comments: [opening sym] [closing sym] [opening sym] [closing sym] ...
# Defines a space-separated list of symbol pairs that are used for block
# comments, if any.
#
# Package Separator: [symbol]
# Defines the default package separator symbol. The default is a dot.
#
# [Topic Type] Prototype Enders: [symbol] [symbol] ...
# When defined, Natural Docs will attempt to get a prototype from the code
# immediately following the topic type. It stops when it reaches one of
# these symbols. Use \n for line breaks.
#
# Line Extender: [symbol]
# Defines the symbol that allows a prototype to span multiple lines if
# normally a line break would end it.
#
# Enum Values: [global|under type|under parent]
# Defines how enum values are referenced. The default is global.
# global - Values are always global, referenced as 'value'.
# under type - Values are under the enum type, referenced as
# 'package.enum.value'.
# under parent - Values are under the enum's parent, referenced as
# 'package.value'.
#
# Perl Package: [perl package]
# Specifies the Perl package used to fine-tune the language behavior in ways
# too complex to do in this file.
#
#------------------------------------------------------------------------------
# For full language support only:
#
# Full Language Support: [perl package]
# Specifies the Perl package that has the parsing routines necessary for full
# language support.
#
#-------------------------------------------------------------------------------
# The following languages are defined in the main file, if you'd like to alter
# them:
#
# Text File, Shebang Script, C/C++, C#, Java, JavaScript, Perl, Python,
# PHP, SQL, Visual Basic, Pascal, Assembly, Ada, Tcl, Ruby, Makefile,
# ActionScript, ColdFusion, R, Fortran
# If you add a language that you think would be useful to other developers
# and should be included in Natural Docs by default, please e-mail it to
# languages [at] naturaldocs [dot] org.
+177
View File
@@ -0,0 +1,177 @@
Format: 1.35
Title: OpenLayers
SubTitle: JavaScript Mapping Library
# You can add a footer to your documentation like this:
# Footer: [text]
# If you want to add a copyright notice, this would be the place to do it.
# --------------------------------------------------------------------------
#
# Cut and paste the lines below to change the order in which your files
# appear on the menu. Don't worry about adding or removing files, Natural
# Docs will take care of that.
#
# You can further organize the menu by grouping the entries. Add a
# "Group: [name] {" line to start a group, and add a "}" to end it.
#
# You can add text and web links to the menu by adding "Text: [text]" and
# "Link: [name] ([URL])" lines, respectively.
#
# The formatting and comments are auto-generated, so don't worry about
# neatness when editing the file. Natural Docs will clean it up the next
# time it is run. When working with groups, just deal with the braces and
# forget about the indentation and comments.
#
# --------------------------------------------------------------------------
File: OpenLayers (OpenLayers.js)
Group: OpenLayers {
File: Ajax (no auto-title, OpenLayers/Ajax.js)
File: Base Types (no auto-title, OpenLayers/BaseTypes.js)
File: Console (no auto-title, OpenLayers/Console.js)
Group: Control {
File: Control (no auto-title, OpenLayers/Control.js)
File: ArgParser (no auto-title, OpenLayers/Control/ArgParser.js)
File: ZoomToMaxExtent (no auto-title, OpenLayers/Control/ZoomToMaxExtent.js)
File: OverviewMap (no auto-title, OpenLayers/Control/OverviewMap.js)
File: DragPan (no auto-title, OpenLayers/Control/DragPan.js)
File: DrawFeature (no auto-title, OpenLayers/Control/DrawFeature.js)
File: EditingToolbar (no auto-title, OpenLayers/Control/EditingToolbar.js)
File: KeyboardDefaults (no auto-title, OpenLayers/Control/KeyboardDefaults.js)
File: LayerSwitcher (no auto-title, OpenLayers/Control/LayerSwitcher.js)
File: MouseDefaults (no auto-title, OpenLayers/Control/MouseDefaults.js)
File: MousePosition (no auto-title, OpenLayers/Control/MousePosition.js)
File: MouseToolbar (no auto-title, OpenLayers/Control/MouseToolbar.js)
File: Navigation (no auto-title, OpenLayers/Control/Navigation.js)
File: NavToolbar (no auto-title, OpenLayers/Control/NavToolbar.js)
File: Panel (no auto-title, OpenLayers/Control/Panel.js)
File: PanZoomBar (no auto-title, OpenLayers/Control/PanZoomBar.js)
File: Permalink (no auto-title, OpenLayers/Control/Permalink.js)
File: Scale (no auto-title, OpenLayers/Control/Scale.js)
File: SelectFeature (no auto-title, OpenLayers/Control/SelectFeature.js)
File: ZoomBox (no auto-title, OpenLayers/Control/ZoomBox.js)
File: PanZoom (OpenLayers/Control/PanZoom.js)
} # Group: Control
File: Events (no auto-title, OpenLayers/Events.js)
Group: Feature {
File: Feature (no auto-title, OpenLayers/Feature.js)
File: WFS (no auto-title, OpenLayers/Feature/WFS.js)
File: Vector (no auto-title, OpenLayers/Feature/Vector.js)
} # Group: Feature
Group: Format {
File: Format (no auto-title, OpenLayers/Format.js)
File: GeoRSS (OpenLayers/Format/GeoRSS.js)
File: GML (OpenLayers/Format/GML.js)
File: KML (OpenLayers/Format/KML.js)
File: WFS (OpenLayers/Format/WFS.js)
File: WKT (no auto-title, OpenLayers/Format/WKT.js)
} # Group: Format
Group: Geometry {
File: Geometry (no auto-title, OpenLayers/Geometry.js)
File: Collection (no auto-title, OpenLayers/Geometry/Collection.js)
File: Curve (OpenLayers/Geometry/Curve.js)
File: LinearRing (OpenLayers/Geometry/LinearRing.js)
File: LineString (no auto-title, OpenLayers/Geometry/LineString.js)
File: MultiLineString (no auto-title, OpenLayers/Geometry/MultiLineString.js)
File: MultiPoint (no auto-title, OpenLayers/Geometry/MultiPoint.js)
File: MultiPolygon (no auto-title, OpenLayers/Geometry/MultiPolygon.js)
File: Point (no auto-title, OpenLayers/Geometry/Point.js)
File: Polygon (no auto-title, OpenLayers/Geometry/Polygon.js)
File: Rectangle (OpenLayers/Geometry/Rectangle.js)
File: Surface (OpenLayers/Geometry/Surface.js)
} # Group: Geometry
Group: Handler {
File: Handler (no auto-title, OpenLayers/Handler.js)
File: Box (OpenLayers/Handler/Box.js)
File: Drag (no auto-title, OpenLayers/Handler/Drag.js)
File: Feature (no auto-title, OpenLayers/Handler/Feature.js)
File: Keyboard (no auto-title, OpenLayers/Handler/Keyboard.js)
File: MouseWheel (no auto-title, OpenLayers/Handler/MouseWheel.js)
File: Path (no auto-title, OpenLayers/Handler/Path.js)
File: Point (no auto-title, OpenLayers/Handler/Point.js)
File: Polygon (OpenLayers/Handler/Polygon.js)
} # Group: Handler
File: Icon (no auto-title, OpenLayers/Icon.js)
Group: Layer {
File: Layer (no auto-title, OpenLayers/Layer.js)
File: Boxes (OpenLayers/Layer/Boxes.js)
File: EventPane (OpenLayers/Layer/EventPane.js)
File: FixedZoomLevels (OpenLayers/Layer/FixedZoomLevels.js)
File: GeoRSS (no auto-title, OpenLayers/Layer/GeoRSS.js)
File: GML (no auto-title, OpenLayers/Layer/GML.js)
File: Grid (OpenLayers/Layer/Grid.js)
File: Image (no auto-title, OpenLayers/Layer/Image.js)
File: MapServer (OpenLayers/Layer/MapServer.js)
File: Markers (no auto-title, OpenLayers/Layer/Markers.js)
File: Text (OpenLayers/Layer/Text.js)
File: Vector (no auto-title, OpenLayers/Layer/Vector.js)
File: WMS (no auto-title, OpenLayers/Layer/WMS.js)
File: WMS.Untiled (no auto-title, OpenLayers/Layer/WMS/Untiled.js)
File: WorldWind (OpenLayers/Layer/WorldWind.js)
} # Group: Layer
File: Map (no auto-title, OpenLayers/Map.js)
Group: Marker {
File: Marker (no auto-title, OpenLayers/Marker.js)
File: Box (no auto-title, OpenLayers/Marker/Box.js)
} # Group: Marker
Group: Popup {
File: Popup (no auto-title, OpenLayers/Popup.js)
File: Anchored (no auto-title, OpenLayers/Popup/Anchored.js)
File: AnchoredBubble (OpenLayers/Popup/AnchoredBubble.js)
} # Group: Popup
Group: Renderer {
File: Renderer (OpenLayers/Renderer.js)
File: Elements (no auto-title, OpenLayers/Renderer/Elements.js)
File: SVG (no auto-title, OpenLayers/Renderer/SVG.js)
File: VML (no auto-title, OpenLayers/Renderer/VML.js)
} # Group: Renderer
Group: Tile {
File: Tile (no auto-title, OpenLayers/Tile.js)
File: Image (no auto-title, OpenLayers/Tile/Image.js)
File: WFS (no auto-title, OpenLayers/Tile/WFS.js)
} # Group: Tile
File: Util (OpenLayers/Util.js)
} # Group: OpenLayers
Group: Index {
Index: Everything
Class Index: Classes
Constant Index: Constants
Function Index: Functions
Property Index: Properties
File Index: Files
Constructor Index: Constructor
} # Group: Index
+20
View File
@@ -0,0 +1,20 @@
p {
text-indent: 0; margin-bottom: 1em;
}
.MGroup {
font-variant: normal;
margin: 0.4em 0 0em 10px
}
.MTitle {
font-variant: normal;
}
.CGroup .CTitle {
font-variant: normal;
}
.SGroup .SEntry {
font-variant: normal;
}
+105
View File
@@ -0,0 +1,105 @@
Format: 1.35
# This is the Natural Docs topics file for this project. If you change anything
# here, it will apply to THIS PROJECT ONLY. If you'd like to change something
# for all your projects, edit the Topics.txt in Natural Docs' Config directory
# instead.
# If you'd like to prevent keywords from being recognized by Natural Docs, you
# can do it like this:
# Ignore Keywords: [keyword], [keyword], ...
#
# Or you can use the list syntax like how they are defined:
# Ignore Keywords:
# [keyword]
# [keyword], [plural keyword]
# ...
#-------------------------------------------------------------------------------
# SYNTAX:
#
# Topic Type: [name]
# Alter Topic Type: [name]
# Creates a new topic type or alters one from the main file. Each type gets
# its own index and behavior settings. Its name can have letters, numbers,
# spaces, and these charaters: - / . '
#
# Plural: [name]
# Sets the plural name of the topic type, if different.
#
# Keywords:
# [keyword]
# [keyword], [plural keyword]
# ...
# Defines or adds to the list of keywords for the topic type. They may only
# contain letters, numbers, and spaces and are not case sensitive. Plural
# keywords are used for list topics. You can redefine keywords found in the
# main topics file.
#
# Index: [yes|no]
# Whether the topics get their own index. Defaults to yes. Everything is
# included in the general index regardless of this setting.
#
# Scope: [normal|start|end|always global]
# How the topics affects scope. Defaults to normal.
# normal - Topics stay within the current scope.
# start - Topics start a new scope for all the topics beneath it,
# like class topics.
# end - Topics reset the scope back to global for all the topics
# beneath it.
# always global - Topics are defined as global, but do not change the scope
# for any other topics.
#
# Class Hierarchy: [yes|no]
# Whether the topics are part of the class hierarchy. Defaults to no.
#
# Variable Type: [yes|no]
# Whether the topics can be a variable type. Defaults to no.
#
# Page Title If First: [yes|no]
# Whether the topic's title becomes the page title if it's the first one in
# a file. Defaults to no.
#
# Break Lists: [yes|no]
# Whether list topics should be broken into individual topics in the output.
# Defaults to no.
#
# Can Group With: [type], [type], ...
# Defines a list of topic types that this one can possibly be grouped with.
# Defaults to none.
#-------------------------------------------------------------------------------
# The following topics are defined in the main file, if you'd like to alter
# their behavior or add keywords:
#
# Generic, Class, Interface, Section, File, Group, Function, Variable,
# Property, Type, Constant, Enumeration, Event, Delegate, Macro,
# Database, Database Table, Database View, Database Index, Database
# Cursor, Database Trigger, Cookie, Build Target
# If you add something that you think would be useful to other developers
# and should be included in Natural Docs by default, please e-mail it to
# topics [at] naturaldocs [dot] org.
Topic Type: Constructor
Class Hierarchy: Yes
Keywords:
constructor
initialize
Alter Topic Type: Function
Add Keywords:
apimethod
apifunction
Alter Topic Type: Property
Add Keywords:
apiproperty
+13 -9
View File
@@ -6,9 +6,6 @@
* @requires OpenLayers/BaseTypes.js * @requires OpenLayers/BaseTypes.js
*/ */
////
/// This blob sucks in all the files in uncompressed form for ease of use
///
(function() { (function() {
/** /**
* Before creating the OpenLayers namespace, check to see if * Before creating the OpenLayers namespace, check to see if
@@ -17,22 +14,25 @@
* case with single file builds. * case with single file builds.
*/ */
var singleFile = (typeof OpenLayers == "object" && OpenLayers.singleFile); var singleFile = (typeof OpenLayers == "object" && OpenLayers.singleFile);
/** /**
* Namespace: OpenLayers
* The OpenLayers object provides a namespace for all things OpenLayers * The OpenLayers object provides a namespace for all things OpenLayers
* @type Object
*/ */
OpenLayers = { OpenLayers = {
/** /**
* @type String * Property: _scriptName
* @private * {String} Relative path of this script.
*/ */
_scriptName: (!singleFile) ? "lib/OpenLayers.js" : "OpenLayers.js", _scriptName: (!singleFile) ? "lib/OpenLayers.js" : "OpenLayers.js",
/** /**
* @type String * Function: _getScriptLocation
* @returns Path to this script * Return the path to this script.
* @private *
* Return:
* Path to this script
*/ */
_getScriptLocation: function () { _getScriptLocation: function () {
var scriptLocation = ""; var scriptLocation = "";
@@ -184,4 +184,8 @@
if (allScriptTags) document.write(allScriptTags); if (allScriptTags) document.write(allScriptTags);
} }
})(); })();
/**
* Constant: VERSION_NUMBER
*/
OpenLayers.VERSION_NUMBER="$Revision$"; OpenLayers.VERSION_NUMBER="$Revision$";
+399 -203
View File
@@ -37,16 +37,19 @@ OpenLayers.nullHandler = function(request) {
alert("Unhandled request return " + request.statusText); alert("Unhandled request return " + request.statusText);
}; };
/** Background load a document /**
* * Function: loadURL
* @param {String} uri URI of source doc * Background load a document.
* @param {String} params Params on get (doesnt seem to work) *
* @param {Object} caller object which gets callbacks * Parameters:
* @param {Function} onComplete callback for success * uri - {String} URI of source doc
* @param {Function} onFailure callback for failure * params - {String} Params on get (doesnt seem to work)
* * caller - {Object} object which gets callbacks
* Both callbacks optional (though silly) * onComplete - {Function} callback for success
*/ * onFailure - {Function} callback for failure
*
* Both callbacks optional (though silly)
*/
OpenLayers.loadURL = function(uri, params, caller, OpenLayers.loadURL = function(uri, params, caller,
onComplete, onFailure) { onComplete, onFailure) {
@@ -70,12 +73,16 @@ OpenLayers.loadURL = function(uri, params, caller,
); );
}; };
/** Parse XML into a doc structure /**
* @param {String} text * Function: parseXMLString
* * Parse XML into a doc structure
* @returns Parsed Ajax Response ?? *
* @type ? * Parameters:
*/ * text - {String}
*
* Return:
* {?} Parsed AJAX Responsev
*/
OpenLayers.parseXMLString = function(text) { OpenLayers.parseXMLString = function(text) {
//MS sucks, if the server is bad it dies //MS sucks, if the server is bad it dies
@@ -108,224 +115,413 @@ OpenLayers.parseXMLString = function(text) {
return ajaxResponse; return ajaxResponse;
}; };
/**
* Namespace: OpenLayers.Ajax
*/
OpenLayers.Ajax = { OpenLayers.Ajax = {
emptyFunction: function () {},
getTransport: function() { /**
return OpenLayers.Util.Try( * Method: emptyFunction
function() {return new ActiveXObject('Msxml2.XMLHTTP')}, */
function() {return new ActiveXObject('Microsoft.XMLHTTP')}, emptyFunction: function () {},
function() {return new XMLHttpRequest()}
) || false;
},
activeRequestCount: 0 /**
* Method: getTransport
*
* Return:
* {Object} Transport mechanism for whichever browser we're in, or false if
* none available.
*/
getTransport: function() {
return OpenLayers.Util.Try(
function() {return new ActiveXObject('Msxml2.XMLHTTP')},
function() {return new ActiveXObject('Microsoft.XMLHTTP')},
function() {return new XMLHttpRequest()}
) || false;
},
/**
* Property: activeRequestCount
* {Integer}
*/
activeRequestCount: 0
}; };
/**
* Namespace: OpenLayers.Ajax.Responders
* {Object}
*/
OpenLayers.Ajax.Responders = { OpenLayers.Ajax.Responders = {
responders: [],
/**
* Property: responders
* {Array}
*/
responders: [],
register: function(responderToAdd) { /**
for (var i = 0; i < this.responders.length; i++) * Method: register
if (responderToAdd == this.responders[i]) *
return; * Parameters:
this.responders.push(responderToAdd); * responderToAdd - {?}
}, */
register: function(responderToAdd) {
for (var i = 0; i < this.responders.length; i++)
if (responderToAdd == this.responders[i])
return;
this.responders.push(responderToAdd);
},
dispatch: function(callback, request, transport, json) { /**
for (var i = 0; i < this.responders.length; i++) { * Method: dispatch
responder = this.responders[i]; *
if (responder[callback] && typeof responder[callback] == 'function') { * Parameters:
try { * callback - {?}
responder[callback].apply(responder, [request, transport, json]); * request - {?}
} catch (e) {} * transport - {?}
} * json - {?}
*/
dispatch: function(callback, request, transport, json) {
for (var i = 0; i < this.responders.length; i++) {
responder = this.responders[i];
if (responder[callback] &&
typeof responder[callback] == 'function') {
try {
responder[callback].apply(responder,
[request, transport, json]);
} catch (e) {}
}
}
} }
}
}; };
OpenLayers.Ajax.Responders.register({ OpenLayers.Ajax.Responders.register({
onCreate: function() { /**
OpenLayers.Ajax.activeRequestCount++; * Function: onCreate
}, */
onCreate: function() {
OpenLayers.Ajax.activeRequestCount++;
},
onComplete: function() { /**
OpenLayers.Ajax.activeRequestCount--; * Function: onComplete
} */
onComplete: function() {
OpenLayers.Ajax.activeRequestCount--;
}
}); });
/**
* Namespace: OpenLayers.Ajax.Base
* {Object}
*/
OpenLayers.Ajax.Base = function() {}; OpenLayers.Ajax.Base = function() {};
OpenLayers.Ajax.Base.prototype = { OpenLayers.Ajax.Base.prototype = {
setOptions: function(options) {
this.options = { /**
method: 'post', * Function: setOptions
asynchronous: true, *
parameters: '' * Parameters:
* options - {Object}
*/
setOptions: function(options) {
this.options = {
'method': 'post',
'asynchronous': true,
'parameters': ''
};
OpenLayers.Util.extend(this.options, options || {});
},
/**
* Function: responseIsSuccess
*
* Return:
* {Boolean}
*/
responseIsSuccess: function() {
return this.transport.status == undefined ||
this.transport.status == 0 ||
(this.transport.status >= 200 && this.transport.status < 300);
},
/**
* Function: responseIsFailure
*
* Return:
* {Boolean}
*/
responseIsFailure: function() {
return !this.responseIsSuccess();
} }
OpenLayers.Util.extend(this.options, options || {}); };
},
responseIsSuccess: function() {
return this.transport.status == undefined
|| this.transport.status == 0
|| (this.transport.status >= 200 && this.transport.status < 300);
},
responseIsFailure: function() {
return !this.responseIsSuccess();
}
}
/**
* Class: OpenLayers.Ajax.Request
*
* Inherit:
* - <OpenLayers.Ajax.Base>
*/
OpenLayers.Ajax.Request = OpenLayers.Class.create(); OpenLayers.Ajax.Request = OpenLayers.Class.create();
/**
* Property: Events
* {Array(String)}
*/
OpenLayers.Ajax.Request.Events = OpenLayers.Ajax.Request.Events =
['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete']; ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];
OpenLayers.Ajax.Request.prototype = OpenLayers.Class.inherit( OpenLayers.Ajax.Base, { OpenLayers.Ajax.Request.prototype =
initialize: function(url, options) { OpenLayers.Class.inherit( OpenLayers.Ajax.Base, {
this.transport = OpenLayers.Ajax.getTransport();
this.setOptions(options); /**
this.request(url); * Constructor: OpenLayers.Ajax.Request
}, *
* Parameters:
request: function(url) { * url - {String}
var parameters = this.options.parameters || ''; * options - {Object}
if (parameters.length > 0) parameters += '&_=';
try {
this.url = url;
if (this.options.method == 'get' && parameters.length > 0)
this.url += (this.url.match(/\?/) ? '&' : '?') + parameters;
OpenLayers.Ajax.Responders.dispatch('onCreate', this, this.transport);
this.transport.open(this.options.method, this.url,
this.options.asynchronous);
if (this.options.asynchronous) {
this.transport.onreadystatechange = this.onStateChange.bind(this);
setTimeout((function() {this.respondToReadyState(1)}).bind(this), 10);
}
this.setRequestHeaders();
var body = this.options.postBody ? this.options.postBody : parameters;
this.transport.send(this.options.method == 'post' ? body : null);
/* Force Firefox to handle ready state 4 for synchronous requests */
if (!this.options.asynchronous && this.transport.overrideMimeType) {
this.onStateChange();
}
} catch (e) {
this.dispatchException(e);
}
},
setRequestHeaders: function() {
var requestHeaders =
['X-Requested-With', 'XMLHttpRequest',
'X-Prototype-Version', 'OpenLayers'];
if (this.options.method == 'post' && !this.options.postBody) {
requestHeaders.push('Content-type',
'application/x-www-form-urlencoded');
/* Force "Connection: close" for Mozilla browsers to work around
* a bug where XMLHttpReqeuest sends an incorrect Content-length
* header. See Mozilla Bugzilla #246651.
*/ */
if (this.transport.overrideMimeType) initialize: function(url, options) {
requestHeaders.push('Connection', 'close'); this.transport = OpenLayers.Ajax.getTransport();
this.setOptions(options);
this.request(url);
},
/**
* Method: request
*
* Parameters:
* url - {String}
*/
request: function(url) {
var parameters = this.options.parameters || '';
if (parameters.length > 0) parameters += '&_=';
try {
this.url = url;
if (this.options.method == 'get' && parameters.length > 0) {
this.url += (this.url.match(/\?/) ? '&' : '?') + parameters;
}
OpenLayers.Ajax.Responders.dispatch('onCreate',
this,
this.transport);
this.transport.open(this.options.method,
this.url,
this.options.asynchronous);
if (this.options.asynchronous) {
this.transport.onreadystatechange =
this.onStateChange.bind(this);
setTimeout((function() {
this.respondToReadyState(1)
}).bind(this), 10);
}
this.setRequestHeaders();
var body = this.options.postBody ? this.options.postBody
: parameters;
this.transport.send(this.options.method == 'post' ? body : null);
// Force Firefox to handle ready state 4 for synchronous requests
if (!this.options.asynchronous &&
this.transport.overrideMimeType) {
this.onStateChange();
}
} catch (e) {
this.dispatchException(e);
}
},
/**
* Method: setRequestHeaders
*/
setRequestHeaders: function() {
var requestHeaders = [
'X-Requested-With',
'XMLHttpRequest',
'X-Prototype-Version',
'OpenLayers'
];
if (this.options.method == 'post' && !this.options.postBody) {
requestHeaders.push('Content-type',
'application/x-www-form-urlencoded');
// Force "Connection: close" for Mozilla browsers to work around
// a bug where XMLHttpReqeuest sends an incorrect Content-length
// header. See Mozilla Bugzilla #246651.
if (this.transport.overrideMimeType) {
requestHeaders.push('Connection', 'close');
}
}
if (this.options.requestHeaders) {
requestHeaders.push.apply(requestHeaders,
this.options.requestHeaders);
}
for (var i = 0; i < requestHeaders.length; i += 2) {
this.transport.setRequestHeader(requestHeaders[i],
requestHeaders[i+1]);
}
},
/**
* Method: onStateChange
*/
onStateChange: function() {
var readyState = this.transport.readyState;
if (readyState != 1) {
this.respondToReadyState(this.transport.readyState);
}
},
/**
* Method: header
*
* Return:
* {?}
*/
header: function(name) {
try {
return this.transport.getResponseHeader(name);
} catch (e) {}
},
/**
* Method: evalJSON
*
* Return:
* {?}
*/
evalJSON: function() {
try {
return eval(this.header('X-JSON'));
} catch (e) {}
},
/**
* Method: evalResponse
*
* Return:
* {?}
*/
evalResponse: function() {
try {
return eval(this.transport.responseText);
} catch (e) {
this.dispatchException(e);
}
},
/**
* Method: respondToReadyState
*
* Parameters:
* readyState - {?}
*/
respondToReadyState: function(readyState) {
var event = OpenLayers.Ajax.Request.Events[readyState];
var transport = this.transport, json = this.evalJSON();
if (event == 'Complete') {
try {
var responseSuccess = this.responseIsSuccess() ? 'Success'
: 'Failure';
(this.options['on' + this.transport.status] ||
this.options['on' + responseSuccess] ||
OpenLayers.Ajax.emptyFunction)(transport, json);
} catch (e) {
this.dispatchException(e);
}
var contentType = this.header('Content-type') || '';
if (contentType.match(/^text\/javascript/i)) {
this.evalResponse();
}
}
try {
(this.options['on' + event] ||
OpenLayers.Ajax.emptyFunction)(transport, json);
OpenLayers.Ajax.Responders.dispatch('on' + event,
this,
transport,
json);
} catch (e) {
this.dispatchException(e);
}
// Avoid memory leak in MSIE: clean up the oncomplete event handler
if (event == 'Complete') {
this.transport.onreadystatechange = OpenLayers.Ajax.emptyFunction;
}
},
/**
* Method: dispatchException
*
* Parameters:
* exception - {?}
*/
dispatchException: function(exception) {
if (this.options.onException) {
this.options.onException(this, exception);
} else {
// if we get here, Responders.dispatch('onException') will never
// be called. too bad. we should probably take out the Responders
// stuff anyway.
throw exception;
}
OpenLayers.Ajax.Responders.dispatch('onException', this, exception);
} }
if (this.options.requestHeaders)
requestHeaders.push.apply(requestHeaders, this.options.requestHeaders);
for (var i = 0; i < requestHeaders.length; i += 2)
this.transport.setRequestHeader(requestHeaders[i], requestHeaders[i+1]);
},
onStateChange: function() {
var readyState = this.transport.readyState;
if (readyState != 1)
this.respondToReadyState(this.transport.readyState);
},
header: function(name) {
try {
return this.transport.getResponseHeader(name);
} catch (e) {}
},
evalJSON: function() {
try {
return eval(this.header('X-JSON'));
} catch (e) {}
},
evalResponse: function() {
try {
return eval(this.transport.responseText);
} catch (e) {
this.dispatchException(e);
}
},
respondToReadyState: function(readyState) {
var event = OpenLayers.Ajax.Request.Events[readyState];
var transport = this.transport, json = this.evalJSON();
if (event == 'Complete') {
try {
(this.options['on' + this.transport.status]
|| this.options['on' + (this.responseIsSuccess() ? 'Success' : 'Failure')]
|| OpenLayers.Ajax.emptyFunction)(transport, json);
} catch (e) {
this.dispatchException(e);
}
if ((this.header('Content-type') || '').match(/^text\/javascript/i))
this.evalResponse();
}
try {
(this.options['on' + event] || OpenLayers.Ajax.emptyFunction)(transport, json);
OpenLayers.Ajax.Responders.dispatch('on' + event, this, transport, json);
} catch (e) {
this.dispatchException(e);
}
/* Avoid memory leak in MSIE: clean up the oncomplete event handler */
if (event == 'Complete')
this.transport.onreadystatechange = OpenLayers.Ajax.emptyFunction;
},
dispatchException: function(exception) {
if (this.options.onException) {
this.options.onException(this, exception);
} else {
// if we get here, Responders.dispatch('onException') will never
// be called. too bad. we should probably take out the Responders
// stuff anyway.
throw exception;
}
OpenLayers.Ajax.Responders.dispatch('onException', this, exception);
}
}); });
OpenLayers.Ajax.getElementsByTagNameNS = function(parentnode, nsuri, nsprefix, tagname) { /**
return parentnode.getElementsByTagNameNS ? * Function: getElementsByTagNameNS
parentnode.getElementsByTagNameNS(nsuri, tagname) *
: parentnode.getElementsByTagName(nsprefix + ':' + tagname); * Parameters:
} * parentnode - {?}
* nsuri - {?}
* nsprefix - {?}
* tagname - {?}
*
* Return:
* {?}
*/
OpenLayers.Ajax.getElementsByTagNameNS = function(parentnode, nsuri,
nsprefix, tagname) {
var elem = null;
if (parentnode.getElementsByTagNameNS) {
elem = parentnode.getElementsByTagNameNS(nsuri, tagname);
} else {
elem = parentnode.getElementsByTagName(nsprefix + ':' + tagname);
}
return elem;
};
/** /**
* Function: serializeXMLToString
* Wrapper function around XMLSerializer, which doesn't exist/work in * Wrapper function around XMLSerializer, which doesn't exist/work in
* IE/Safari. We need to come up with a way to serialize in those browser: * IE/Safari. We need to come up with a way to serialize in those browser:
* for now, these browsers will just fail. * for now, these browsers will just fail. #535, #536
* #535, #536
* *
* @param {XMLNode} xmldom xml dom to serialize * Parameters:
* xmldom {XMLNode} xml dom to serialize
*
* Return:
* {?}
*/ */
OpenLayers.Ajax.serializeXMLToString = function(xmldom) { OpenLayers.Ajax.serializeXMLToString = function(xmldom) {
var serializer = new XMLSerializer(); var serializer = new XMLSerializer();
File diff suppressed because it is too large Load Diff
+43 -22
View File
@@ -3,17 +3,18 @@
* for the full text of the license. */ * for the full text of the license. */
/** /**
* Namespace: OpenLayers.Console
* The OpenLayers.Console namespace is used for debugging and error logging. * The OpenLayers.Console namespace is used for debugging and error logging.
* If the Firebug Lite (../Firebug/firebug.js) is included before this script, * If the Firebug Lite (../Firebug/firebug.js) is included before this script,
* calls to OpenLayers.Console methods will get redirected to window.console. * calls to OpenLayers.Console methods will get redirected to window.console.
* This makes use of the Firebug extension where available and allows for * This makes use of the Firebug extension where available and allows for
* cross-browser debugging Firebug style. * cross-browser debugging Firebug style.
* *
* Note:
* Note that behavior will differ with the Firebug extention and Firebug Lite. * Note that behavior will differ with the Firebug extention and Firebug Lite.
* Most notably, the Firebug Lite console does not currently allow for * Most notably, the Firebug Lite console does not currently allow for
* hyperlinks to code or for clicking on object to explore their properties. * hyperlinks to code or for clicking on object to explore their properties.
* *
* @fileoverview Error logging and debugging console
*/ */
OpenLayers.Console = { OpenLayers.Console = {
/** /**
@@ -24,6 +25,7 @@ OpenLayers.Console = {
*/ */
/** /**
* APIFunction: log
* Log an object in the console. The Firebug Lite console logs string * Log an object in the console. The Firebug Lite console logs string
* representation of objects. Given multiple arguments, they will * representation of objects. Given multiple arguments, they will
* be cast to strings and logged with a space delimiter. If the first * be cast to strings and logged with a space delimiter. If the first
@@ -31,86 +33,95 @@ OpenLayers.Console = {
* will be used in string substitution. Any additional arguments (beyond * will be used in string substitution. Any additional arguments (beyond
* the number substituted in a format string) will be appended in a space- * the number substituted in a format string) will be appended in a space-
* delimited line. * delimited line.
*
* Examples:
* // Firebug Lite logs someObject.toString()
* OpenLayers.Console.log(someObject);
* *
* // string substitution * Parameters:
* OpenLayers.Console.log("%s jumped over %s", cow, moon); * object - {Object}
*
* @param {Object} object
*/ */
log: function() {}, log: function() {},
/** /**
* APIFunction: debug
* Writes a message to the console, including a hyperlink to the line * Writes a message to the console, including a hyperlink to the line
* where it was called. * where it was called.
* *
* May be called with multiple arguments as with OpenLayers.Console.log(). * May be called with multiple arguments as with OpenLayers.Console.log().
* *
* @param (Object) object * Parameters:
* object - {Object}
*/ */
debug: function() {}, debug: function() {},
/** /**
* APIFunction: info
* Writes a message to the console with the visual "info" icon and color * Writes a message to the console with the visual "info" icon and color
* coding and a hyperlink to the line where it was called. * coding and a hyperlink to the line where it was called.
* *
* May be called with multiple arguments as with OpenLayers.Console.log(). * May be called with multiple arguments as with OpenLayers.Console.log().
* *
* @param (Object) object * Parameters:
* object - {Object}
*/ */
info: function() {}, info: function() {},
/** /**
* APIFunction: warn
* Writes a message to the console with the visual "warning" icon and * Writes a message to the console with the visual "warning" icon and
* color coding and a hyperlink to the line where it was called. * color coding and a hyperlink to the line where it was called.
* *
* May be called with multiple arguments as with OpenLayers.Console.log(). * May be called with multiple arguments as with OpenLayers.Console.log().
* *
* @param (Object) object * Parameters:
* object - {Object}
*/ */
warn: function() {}, warn: function() {},
/** /**
* APIFunction: error
* Writes a message to the console with the visual "error" icon and color * Writes a message to the console with the visual "error" icon and color
* coding and a hyperlink to the line where it was called. * coding and a hyperlink to the line where it was called.
* *
* May be called with multiple arguments as with OpenLayers.Console.log(). * May be called with multiple arguments as with OpenLayers.Console.log().
* *
* @param (Object) object * Parameters:
* object - {Object}
*/ */
error: function() {}, error: function() {},
/** /**
* APIFunction: assert
* Tests that an expression is true. If not, it will write a message to * Tests that an expression is true. If not, it will write a message to
* the console and throw an exception. * the console and throw an exception.
* *
* May be called with multiple arguments as with OpenLayers.Console.log(). * May be called with multiple arguments as with OpenLayers.Console.log().
* *
* @param (Object) expression * Parameters:
* object - {Object}
*/ */
assert: function() {}, assert: function() {},
/** /**
* APIFunction: dir
* Prints an interactive listing of all properties of the object. This * Prints an interactive listing of all properties of the object. This
* looks identical to the view that you would see in the DOM tab. * looks identical to the view that you would see in the DOM tab.
* *
* @param (Object) object * Parameters:
* object - {Object}
*/ */
dir: function() {}, dir: function() {},
/** /**
* APIFunction: dirxml
* Prints the XML source tree of an HTML or XML element. This looks * Prints the XML source tree of an HTML or XML element. This looks
* identical to the view that you would see in the HTML tab. You can click * identical to the view that you would see in the HTML tab. You can click
* on any node to inspect it in the HTML tab. * on any node to inspect it in the HTML tab.
* *
* @param (Object) object * Parameters:
* object - {Object}
*/ */
dirxml: function() {}, dirxml: function() {},
/** /**
* APIFunction: trace
* Prints an interactive stack trace of JavaScript execution at the point * Prints an interactive stack trace of JavaScript execution at the point
* where it is called. The stack trace details the functions on the stack, * where it is called. The stack trace details the functions on the stack,
* as well as the values that were passed as arguments to each function. * as well as the values that were passed as arguments to each function.
@@ -121,28 +132,33 @@ OpenLayers.Console = {
trace: function() {}, trace: function() {},
/** /**
* APIFunction: group
* Writes a message to the console and opens a nested block to indent all * Writes a message to the console and opens a nested block to indent all
* future messages sent to the console. Call OpenLayers.Console.groupEnd() * future messages sent to the console. Call OpenLayers.Console.groupEnd()
* to close the block. * to close the block.
* *
* May be called with multiple arguments as with OpenLayers.Console.log(). * May be called with multiple arguments as with OpenLayers.Console.log().
* *
* @param (Object) object * Parameters:
* object - {Object}
*/ */
group: function() {}, group: function() {},
/** /**
* APIFunction: groupEnd
* Closes the most recently opened block created by a call to * Closes the most recently opened block created by a call to
* OpenLayers.Console.group * OpenLayers.Console.group
*/ */
groupEnd: function() {}, groupEnd: function() {},
/** /**
* APIFunction: time
* Creates a new timer under the given name. Call * Creates a new timer under the given name. Call
* OpenLayers.Console.timeEnd(name) * OpenLayers.Console.timeEnd(name)
* with the same name to stop the timer and print the time elapsed. * with the same name to stop the timer and print the time elapsed.
* *
* @param {String} name * Parameters:
* name - {String}
*/ */
time: function() {}, time: function() {},
@@ -150,7 +166,8 @@ OpenLayers.Console = {
* Stops a timer created by a call to OpenLayers.Console.time(name) and * Stops a timer created by a call to OpenLayers.Console.time(name) and
* writes the time elapsed. * writes the time elapsed.
* *
* @param {String} name * Parameters:
* name - {String}
*/ */
timeEnd: function() {}, timeEnd: function() {},
@@ -160,7 +177,8 @@ OpenLayers.Console = {
* *
* This function is not currently implemented in Firebug Lite. * This function is not currently implemented in Firebug Lite.
* *
* @param {String} title Optional title for the profiler * Parameters:
* title - {String} Optional title for the profiler
*/ */
profile: function() {}, profile: function() {},
@@ -178,11 +196,14 @@ OpenLayers.Console = {
* *
* This function is not currently implemented in Firebug Lite. * This function is not currently implemented in Firebug Lite.
* *
* @param {String} title Optional title to be printed with count * Parameters:
* title - {String} Optional title to be printed with count
*/ */
count: function() {}, count: function() {},
/** @final @type String */ /**
* Constant: CLASS_NAME
*/
CLASS_NAME: "OpenLayers.Console" CLASS_NAME: "OpenLayers.Console"
}; };
+71 -36
View File
@@ -3,7 +3,9 @@
* for the full text of the license. */ * for the full text of the license. */
/** /**
* @class * Class: OpenLayers.Control
* Controls affect the display or behavior of the map. They allow everything
* from panning and zooming to displaying a scale indicator.
*/ */
OpenLayers.Control = OpenLayers.Class.create(); OpenLayers.Control = OpenLayers.Class.create();
@@ -13,40 +15,58 @@ OpenLayers.Control.TYPE_TOOL = 3;
OpenLayers.Control.prototype = { OpenLayers.Control.prototype = {
/** @type String */ /**
id: null, * Property: id
* {String}
*/
id: null,
/** this gets set in the addControl() function in OpenLayers.Map /**
* @type OpenLayers.Map */ * Property: map
map: null, * {<OpenLayers.Map>} this gets set in the addControl() function in
* OpenLayers.Map
/** @type DOMElement */ */
div: null, map: null,
/** /**
* Controls can have a 'type'. The type determines the type of interactions * Property: div
* which are possible with them when they are placed into a toolbar. * {DOMElement}
* */
* @type OpenLayers.Control.TYPES div: null,
*/
type: null,
/** This property is used for CSS related to the drawing of the Control. /**
* * Property: type
* @type string * {OpenLayers.Control.TYPES} Controls can have a 'type'. The type
*/ * determines the type of interactions which are possible with them when
displayClass: "", * they are placed into a toolbar.
*/
type: null,
/** @type boolean */ /**
active: null, * Property: displayClass
* {string} This property is used for CSS related to the drawing of the
* Control.
*/
displayClass: "",
/** @type OpenLayers.Handler */ /**
handler: null, * Property: active
* {boolean} null
*/
active: null,
/**
* Property: handler
* {<OpenLayers.Handler}> null
*/
handler: null,
/** /**
* @constructor * Constructor: OpenLayers.Control
* Create an OpenLayers Control.
* *
* @param {Object} options * Parameters:
* options - {Object}
*/ */
initialize: function (options) { initialize: function (options) {
// We do this before the extend so that instances can override // We do this before the extend so that instances can override
@@ -60,7 +80,7 @@ OpenLayers.Control.prototype = {
}, },
/** /**
* * Method: destroy
*/ */
destroy: function () { destroy: function () {
// eliminate circular references // eliminate circular references
@@ -70,11 +90,14 @@ OpenLayers.Control.prototype = {
this.map = null; this.map = null;
}, },
/** Set the map property for the control. This is done through an accessor /**
* Method: setMap
* Set the map property for the control. This is done through an accessor
* so that subclasses can override this and take special action once * so that subclasses can override this and take special action once
* they have their map variable set. * they have their map variable set.
* *
* @param {OpenLayers.Map} map * Parameters:
* map - {<OpenLayers.Map>}
*/ */
setMap: function(map) { setMap: function(map) {
this.map = map; this.map = map;
@@ -84,10 +107,13 @@ OpenLayers.Control.prototype = {
}, },
/** /**
* @param {OpenLayers.Pixel} px * Method: draw
* *
* @returns A reference to the DIV DOMElement containing the control * Parameters:
* @type DOMElement * px - {<OpenLayers.Pixel>}
*
* Return:
* {DOMElement} A reference to the DIV DOMElement containing the control
*/ */
draw: function (px) { draw: function (px) {
if (this.div == null) { if (this.div == null) {
@@ -103,7 +129,10 @@ OpenLayers.Control.prototype = {
}, },
/** /**
* @param {OpenLayers.Pixel} px * Method: moveTo
*
* Parameters:
* px - {<OpenLayers.Pixel>}
*/ */
moveTo: function (px) { moveTo: function (px) {
if ((px != null) && (this.div != null)) { if ((px != null) && (this.div != null)) {
@@ -113,7 +142,10 @@ OpenLayers.Control.prototype = {
}, },
/** /**
* @type boolean * Method: activate
*
* Return:
* {Boolean}
*/ */
activate: function () { activate: function () {
if (this.active) { if (this.active) {
@@ -127,7 +159,10 @@ OpenLayers.Control.prototype = {
}, },
/** /**
* @type boolean * Method: deactivate
*
* Return:
* {Boolean}
*/ */
deactivate: function () { deactivate: function () {
if (this.active) { if (this.active) {
+33 -13
View File
@@ -1,38 +1,54 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license. /* Cpyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt * See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
* for the full text of the license. */ * for the full text of the license. */
/** /**
* @class
*
* @requires OpenLayers/Control.js * @requires OpenLayers/Control.js
*
* Class: OpenLayers.Control.ArgParser
*
* Inherits from:
* - <OpenLayers.Control>
*/ */
OpenLayers.Control.ArgParser = OpenLayers.Class.create(); OpenLayers.Control.ArgParser = OpenLayers.Class.create();
OpenLayers.Control.ArgParser.prototype = OpenLayers.Control.ArgParser.prototype =
OpenLayers.Class.inherit( OpenLayers.Control, { OpenLayers.Class.inherit( OpenLayers.Control, {
/** @type OpenLayers.LonLat */ /**
* Parameter: center
* {<OpenLayers.LonLat>}
*/
center: null, center: null,
/** @type int */ /**
* Parameter: zoom
* {int}
*/
zoom: null, zoom: null,
/** @type Array */ /**
* Parameter: layers
* {Array}
*/
layers: null, layers: null,
/** /**
* @constructor * Constructor: OpenLayers.Control.ArgParser
* *
* @param {Object} options * Parameters:
* options - {Object}
*/ */
initialize: function(options) { initialize: function(options) {
OpenLayers.Control.prototype.initialize.apply(this, arguments); OpenLayers.Control.prototype.initialize.apply(this, arguments);
}, },
/** Set the map property for the control. /**
* Method: setMap
* Set the map property for the control.
* *
* @param {OpenLayers.Map} map * Parameters:
* map - {<OpenLayers.Map>}
*/ */
setMap: function(map) { setMap: function(map) {
OpenLayers.Control.prototype.setMap.apply(this, arguments); OpenLayers.Control.prototype.setMap.apply(this, arguments);
@@ -72,7 +88,9 @@ OpenLayers.Control.ArgParser.prototype =
} }
}, },
/** As soon as a baseLayer has been loaded, we center and zoom /**
* Method: setCenter
* As soon as a baseLayer has been loaded, we center and zoom
* ...and remove the handler. * ...and remove the handler.
*/ */
setCenter: function() { setCenter: function() {
@@ -86,7 +104,9 @@ OpenLayers.Control.ArgParser.prototype =
} }
}, },
/** As soon as all the layers are loaded, cycle through them and /**
* Method: configureLayers
* As soon as all the layers are loaded, cycle through them and
* hide or show them. * hide or show them.
*/ */
configureLayers: function() { configureLayers: function() {
+22 -6
View File
@@ -3,19 +3,29 @@
* for the full text of the license. */ * for the full text of the license. */
/** /**
* @class
*
* @requires OpenLayers/Control.js * @requires OpenLayers/Control.js
* @requires OpenLayers/Handler/Drag.js * @requires OpenLayers/Handler/Drag.js
*
* Class: OpenLayers.Control.DragPan
* DragPan control.
*
* Inherits from:
* - <OpenLayers.Control>
*/ */
OpenLayers.Control.DragPan = OpenLayers.Class.create(); OpenLayers.Control.DragPan = OpenLayers.Class.create();
OpenLayers.Control.DragPan.prototype = OpenLayers.Control.DragPan.prototype =
OpenLayers.Class.inherit( OpenLayers.Control, { OpenLayers.Class.inherit( OpenLayers.Control, {
/** @type OpenLayers.Control.TYPES */
/**
* Property: type
* {OpenLayers.Control.TYPES}
*/
type: OpenLayers.Control.TYPE_TOOL, type: OpenLayers.Control.TYPE_TOOL,
/** /**
* * Method: draw
* Creates a Drag handler, using <OpenLayers.Control.PanMap.panMap> and
* <OpenLayers.Control.PanMap.panMapDone> as callbacks.
*/ */
draw: function() { draw: function() {
this.handler = new OpenLayers.Handler.Drag( this, this.handler = new OpenLayers.Handler.Drag( this,
@@ -23,7 +33,10 @@ OpenLayers.Control.DragPan.prototype =
}, },
/** /**
* @param {OpenLayers.Pixel} xy Pixel of the up position * Method: panMap
*
* Parameters:
* xy - {<OpenLayers.Pixel>} Pixel of the up position
*/ */
panMap: function (xy) { panMap: function (xy) {
var deltaX = this.handler.start.x - xy.x; var deltaX = this.handler.start.x - xy.x;
@@ -39,7 +52,10 @@ OpenLayers.Control.DragPan.prototype =
}, },
/** /**
* @param {OpenLayers.Pixel} xy Pixel of the up position * Method: panMapDone
*
* Parameters:
* xy - {<OpenLayers.Pixel>} Pixel of the up position
*/ */
panMapDone: function (xy) { panMapDone: function (xy) {
var deltaX = this.handler.start.x - xy.x; var deltaX = this.handler.start.x - xy.x;
+21 -13
View File
@@ -4,42 +4,50 @@
/** /**
* Draws features on a vector layer when active.
*
* @class
* @requires OpenLayers/Control.js * @requires OpenLayers/Control.js
* @requires OpenLayers/Feature/Vector.js * @requires OpenLayers/Feature/Vector.js
*
* Class: OpenLayers.Control.DrawFeature
* Draws features on a vector layer when active.
*
* Inherits from:
* - <OpenLayers.Control>
*/ */
OpenLayers.Control.DrawFeature = OpenLayers.Class.create(); OpenLayers.Control.DrawFeature = OpenLayers.Class.create();
OpenLayers.Control.DrawFeature.prototype = OpenLayers.Control.DrawFeature.prototype =
OpenLayers.Class.inherit(OpenLayers.Control, { OpenLayers.Class.inherit(OpenLayers.Control, {
/** /**
* @type OpenLayers.Layer.Vector * Property: layer
* {<OpenLayers.Layer.Vector>}
*/ */
layer: null, layer: null,
/** /**
* @type {Object} The functions that are sent to the handler for callback * Property: callbacks
* {Object} The functions that are sent to the handler for callback
*/ */
callbacks: null, callbacks: null,
/** /**
* @type {Function} Called after each feature is added * APIProperty: featureAdded
* {Function} Called after each feature is added
*/ */
featureAdded: function() {}, featureAdded: function() {},
/** /**
* Used to set non-default properties on the control's handler * APIProperty: handlerOptions
* * {Object} Used to set non-default properties on the control's handler
* @type Object
*/ */
handlerOptions: null, handlerOptions: null,
/** /**
* @param {OpenLayers.Layer.Vector} layer * Constructor: OpenLayers.Control.DrawFeature
* @param {OpenLayers.Handler} handler *
* @param {Object} options * Parameters:
* layer - {<OpenLayers.Layer.Vector>}
* handler - {<OpenLayers.Handler>}
* options - {Object}
*/ */
initialize: function(layer, handler, options) { initialize: function(layer, handler, options) {
OpenLayers.Control.prototype.initialize.apply(this, [options]); OpenLayers.Control.prototype.initialize.apply(this, [options]);
@@ -50,7 +58,7 @@ OpenLayers.Control.DrawFeature.prototype =
}, },
/** /**
* * Method: drawFeature
*/ */
drawFeature: function(geometry) { drawFeature: function(geometry) {
var feature = new OpenLayers.Feature.Vector(geometry); var feature = new OpenLayers.Feature.Vector(geometry);
+9 -4
View File
@@ -3,20 +3,24 @@
* for the full text of the license. */ * for the full text of the license. */
/** /**
* @class
*
* @requires OpenLayers/Control/Panel.js * @requires OpenLayers/Control/Panel.js
* @requires OpenLayers/Control/Navigation.js * @requires OpenLayers/Control/Navigation.js
* @requires OpenLayers/Control/DrawFeature.js * @requires OpenLayers/Control/DrawFeature.js
*
* Class: OpenLayers.Control.EditingToolbar
*/ */
OpenLayers.Control.EditingToolbar = OpenLayers.Class.create(); OpenLayers.Control.EditingToolbar = OpenLayers.Class.create();
OpenLayers.Control.EditingToolbar.prototype = OpenLayers.Control.EditingToolbar.prototype =
OpenLayers.Class.inherit( OpenLayers.Control.Panel, { OpenLayers.Class.inherit( OpenLayers.Control.Panel, {
/** /**
* Constructor: OpenLayers.Control.EditingToolbar
* Create an editing toolbar for a given layer. * Create an editing toolbar for a given layer.
* @param {OpenLayers.Layer.Vector} layer *
* @param {Object} options * Parameters:
* layer - {<OpenLayers.Layer.Vector>}
* options - {Object}
*/ */
initialize: function(layer, options) { initialize: function(layer, options) {
OpenLayers.Control.Panel.prototype.initialize.apply(this, [options]); OpenLayers.Control.Panel.prototype.initialize.apply(this, [options]);
@@ -36,6 +40,7 @@ OpenLayers.Control.EditingToolbar.prototype =
}, },
/** /**
* Method: draw
* calls the default draw, and then activates mouse defaults. * calls the default draw, and then activates mouse defaults.
*/ */
draw: function() { draw: function() {
+18 -8
View File
@@ -4,27 +4,33 @@
/** /**
* @class
*
* @requires OpenLayers/Control.js * @requires OpenLayers/Control.js
* @requires OpenLayers/Handler/Keyboard.js * @requires OpenLayers/Handler/Keyboard.js
*
* Class: OpenLayers.Control.KeyboardDefaults
*
* Inherits from:
* - <OpenLayers.Control>
*/ */
OpenLayers.Control.KeyboardDefaults = OpenLayers.Class.create(); OpenLayers.Control.KeyboardDefaults = OpenLayers.Class.create();
OpenLayers.Control.KeyboardDefaults.prototype = OpenLayers.Control.KeyboardDefaults.prototype =
OpenLayers.Class.inherit( OpenLayers.Control, { OpenLayers.Class.inherit( OpenLayers.Control, {
/** @type int */ /**
* APIProperty: slideFactor
* Pixels to slide by.
*/
slideFactor: 75, slideFactor: 75,
/** /**
* @constructor * Constructor: OpenLayers.Control.KeyboardDefaults
*/ */
initialize: function() { initialize: function() {
OpenLayers.Control.prototype.initialize.apply(this, arguments); OpenLayers.Control.prototype.initialize.apply(this, arguments);
}, },
/** /**
* * APIMethod: destroy
*/ */
destroy: function() { destroy: function() {
if (this.handler) { if (this.handler) {
@@ -36,7 +42,8 @@ OpenLayers.Control.KeyboardDefaults.prototype =
}, },
/** /**
* * Method: draw
* Create handler.
*/ */
draw: function() { draw: function() {
this.handler = new OpenLayers.Handler.Keyboard( this, { this.handler = new OpenLayers.Handler.Keyboard( this, {
@@ -45,8 +52,11 @@ OpenLayers.Control.KeyboardDefaults.prototype =
}, },
/** /**
* @param {Integer} code * Method: defaultKeyPress
*/ *
* Parameters:
* code - {Integer}
*/
defaultKeyPress: function (code) { defaultKeyPress: function (code) {
switch(code) { switch(code) {
case OpenLayers.Event.KEY_LEFT: case OpenLayers.Event.KEY_LEFT:
+126 -70
View File
@@ -3,59 +3,93 @@
* for the full text of the license. */ * for the full text of the license. */
/** /**
* @class * @requires OpenLayers/Control.js
* *
* @requires OpenLayers/Control.js * Class: OpenLayers.Control.LayerSwitcher
* @requires OpenLayers/Control.js *
* Inherits from:
* - <OpenLayers.Control>
*/ */
OpenLayers.Control.LayerSwitcher = OpenLayers.Class.create(); OpenLayers.Control.LayerSwitcher = OpenLayers.Class.create();
OpenLayers.Control.LayerSwitcher.prototype = OpenLayers.Control.LayerSwitcher.prototype =
OpenLayers.Class.inherit( OpenLayers.Control, { OpenLayers.Class.inherit( OpenLayers.Control, {
/** @type String */ /**
* Property: activeColor
*/
activeColor: "darkblue", activeColor: "darkblue",
// DOM Elements // DOM Elements
/** @type DOMElement */ /**
* Property: layersDiv
* {DOMElement}
*/
layersDiv: null, layersDiv: null,
/** @type DOMElement */ /**
* Property: baseLayersDiv
* {DOMElement}
*/
baseLayersDiv: null, baseLayersDiv: null,
/** @type Array */ /**
* Property: baseLayers
* {Array}
*/
baseLayers: null, baseLayers: null,
/** @type DOMElement */ /**
* Property: dataLbl
* {DOMElement}
*/
dataLbl: null, dataLbl: null,
/** @type DOMElement */ /**
* Property: dataLayersDiv
* {DOMElement}
*/
dataLayersDiv: null, dataLayersDiv: null,
/** @type Array */ /**
* Property: dataLayers
* {Array}
*/
dataLayers: null, dataLayers: null,
/** @type DOMElement */ /**
* Property: minimizeDiv
* {DOMElement}
*/
minimizeDiv: null, minimizeDiv: null,
/** @type DOMElement */ /**
* Property: maximizeDiv
* {DOMElement}
*/
maximizeDiv: null, maximizeDiv: null,
/** @type Boolean */ /**
* APIProperty: ascending
* {Boolean}
*/
ascending: true, ascending: true,
/** /**
* @constructor * Constructor: OpenLayers.Control.LayerSwitcher
*/ *
* Parameters:
* options - {Object}
*/
initialize: function(options) { initialize: function(options) {
OpenLayers.Control.prototype.initialize.apply(this, arguments); OpenLayers.Control.prototype.initialize.apply(this, arguments);
}, },
/** /**
* * APIMethod: destroy
*/ */
destroy: function() { destroy: function() {
@@ -77,7 +111,10 @@ OpenLayers.Control.LayerSwitcher.prototype =
}, },
/** /**
* @param {OpenLayers.Map} map * Method: setMap
*
* Properties:
* map - {<OpenLayers.Map>}
*/ */
setMap: function(map) { setMap: function(map) {
OpenLayers.Control.prototype.setMap.apply(this, arguments); OpenLayers.Control.prototype.setMap.apply(this, arguments);
@@ -89,8 +126,11 @@ OpenLayers.Control.LayerSwitcher.prototype =
}, },
/** /**
* @returns A reference to the DIV DOMElement containing the switcher tabs * Method: draw
* @type DOMElement *
* Returns:
* {DOMElement} A reference to the DIV DOMElement containing the switcher
* tabs
*/ */
draw: function() { draw: function() {
OpenLayers.Control.prototype.draw.apply(this); OpenLayers.Control.prototype.draw.apply(this);
@@ -109,12 +149,13 @@ OpenLayers.Control.LayerSwitcher.prototype =
return this.div; return this.div;
}, },
/** user specifies either "base" or "data". we then clear all the /**
* corresponding listeners, the div, and reinitialize a new array. * Method: clearLayersArray
* user specifies either "base" or "data". we then clear all the
* corresponding listeners, the div, and reinitialize a new array.
* *
* @private * Parameters:
* * layersType - {String}
* @param {String} layersType Ei
*/ */
clearLayersArray: function(layersType) { clearLayersArray: function(layersType) {
var layers = this[layersType + "Layers"]; var layers = this[layersType + "Layers"];
@@ -130,12 +171,14 @@ OpenLayers.Control.LayerSwitcher.prototype =
}, },
/** Goes through and takes the current state of the Map and rebuilds the /**
* control to display that state. Groups base layers into a radio-button * Method: redraw
* group and lists each data layer with a checkbox. * Goes through and takes the current state of the Map and rebuilds the
* * control to display that state. Groups base layers into a radio-button
* @returns A reference to the DIV DOMElement containing the control * group and lists each data layer with a checkbox.
* @type DOMElement *
* Returns:
* {DOMElement} A reference to the DIV DOMElement containing the control
*/ */
redraw: function() { redraw: function() {
@@ -219,16 +262,17 @@ OpenLayers.Control.LayerSwitcher.prototype =
return this.div; return this.div;
}, },
/** A label has been clicked, check or uncheck its corresponding input /**
* Method:
* A label has been clicked, check or uncheck its corresponding input
* *
* @private * Parameters:
* * e - {Event}
* @context *
* {DOMElement} inputElem * Context:
* {OpenLayers.Control.LayerSwitcher} layerSwitcher * - {DOMElement} inputElem
* {OpenLayers.Layer} layer * - {<OpenLayers.Control.LayerSwitcher>} layerSwitcher
* * - {<OpenLayers.Layer>} layer
* @param {Event} e
*/ */
onInputClick: function(e) { onInputClick: function(e) {
@@ -246,23 +290,24 @@ OpenLayers.Control.LayerSwitcher.prototype =
OpenLayers.Event.stop(e); OpenLayers.Event.stop(e);
}, },
/** Need to update the map accordingly whenever user clicks in either of /**
* the layers. * Method:
* Need to update the map accordingly whenever user clicks in either of
* the layers.
* *
* @private * Parameters:
* * e - {Event}
* @param {Event} e
*/ */
onLayerClick: function(e) { onLayerClick: function(e) {
this.updateMap(); this.updateMap();
}, },
/** Cycles through the loaded data and base layer input arrays and makes /**
* Method: updateMap
* Cycles through the loaded data and base layer input arrays and makes
* the necessary calls to the Map object such that that the map's * the necessary calls to the Map object such that that the map's
* visual state corresponds to what the user has selected in the control * visual state corresponds to what the user has selected in the control
*
* @private
*/ */
updateMap: function() { updateMap: function() {
@@ -282,9 +327,12 @@ OpenLayers.Control.LayerSwitcher.prototype =
}, },
/** Set up the labels and divs for the control /**
* Method: maximizeControl
* Set up the labels and divs for the control
* *
* @param {Event} e * Parameters:
* e - {Event}
*/ */
maximizeControl: function(e) { maximizeControl: function(e) {
@@ -299,10 +347,13 @@ OpenLayers.Control.LayerSwitcher.prototype =
} }
}, },
/** Hide all the contents of the control, shrink the size, /**
* add the maximize icon * Method: minimizeControl
* * Hide all the contents of the control, shrink the size,
* @param {Event} e * add the maximize icon
*
* Parameters:
* e - {Event}
*/ */
minimizeControl: function(e) { minimizeControl: function(e) {
@@ -316,12 +367,13 @@ OpenLayers.Control.LayerSwitcher.prototype =
} }
}, },
/** Hide/Show all LayerSwitcher controls depending on whether we are /**
* Method: showControls
* Hide/Show all LayerSwitcher controls depending on whether we are
* minimized or not * minimized or not
* *
* @private * Parameters:
* * minimize - {Boolean}
* @param {Boolean} minimize
*/ */
showControls: function(minimize) { showControls: function(minimize) {
@@ -331,8 +383,9 @@ OpenLayers.Control.LayerSwitcher.prototype =
this.layersDiv.style.display = minimize ? "none" : ""; this.layersDiv.style.display = minimize ? "none" : "";
}, },
/** Set up the labels and divs for the control /**
* * Method: loadContents
* Set up the labels and divs for the control
*/ */
loadContents: function() { loadContents: function() {
@@ -460,33 +513,36 @@ OpenLayers.Control.LayerSwitcher.prototype =
}, },
/** /**
* @private * Method: ignoreEvent
* *
* @param {Event} evt * Parameters:
* evt - {Event}
*/ */
ignoreEvent: function(evt) { ignoreEvent: function(evt) {
OpenLayers.Event.stop(evt); OpenLayers.Event.stop(evt);
}, },
/** Register a local 'mouseDown' flag so that we'll know whether or not /**
* Method: mouseDown
* Register a local 'mouseDown' flag so that we'll know whether or not
* to ignore a mouseUp event * to ignore a mouseUp event
* *
* @private * Parameters:
* * evt - {Event}
* @param {Event} evt
*/ */
mouseDown: function(evt) { mouseDown: function(evt) {
this.mouseDown = true; this.mouseDown = true;
this.ignoreEvent(evt); this.ignoreEvent(evt);
}, },
/** If the 'mouseDown' flag has been set, that means that the drag was /**
* Method: mouseUp
* If the 'mouseDown' flag has been set, that means that the drag was
* started from within the LayerSwitcher control, and thus we can * started from within the LayerSwitcher control, and thus we can
* ignore the mouseup. Otherwise, let the Event continue. * ignore the mouseup. Otherwise, let the Event continue.
* *
* @private * Parameters:
* * evt - {Event}
* @param {Event} evt
*/ */
mouseUp: function(evt) { mouseUp: function(evt) {
if (this.mouseDown) { if (this.mouseDown) {
+59 -23
View File
@@ -3,9 +3,12 @@
* for the full text of the license. */ * for the full text of the license. */
/** /**
* @class
*
* @requires OpenLayers/Control.js * @requires OpenLayers/Control.js
*
* Class: OpenLayers.Control.MouseDefaults
*
* Inherits from:
* - <OpenLayers.Control>
*/ */
OpenLayers.Control.MouseDefaults = OpenLayers.Class.create(); OpenLayers.Control.MouseDefaults = OpenLayers.Class.create();
OpenLayers.Control.MouseDefaults.prototype = OpenLayers.Control.MouseDefaults.prototype =
@@ -15,21 +18,27 @@ OpenLayers.Control.MouseDefaults.prototype =
This class is DEPRECATED in 2.4 and will be removed by 3.0. This class is DEPRECATED in 2.4 and will be removed by 3.0.
If you need this functionality, use Control.Navigation instead!!! */ If you need this functionality, use Control.Navigation instead!!! */
/** @type Boolean */ /**
* Property: performedDrag
* {Boolean}
*/
performedDrag: false, performedDrag: false,
/** @type function */ /**
* Property: wheelObserver
* {Function}
*/
wheelObserver: null, wheelObserver: null,
/** /**
* @constructor * Constructor: OpenLayers.Control.MouseDefaults
*/ */
initialize: function() { initialize: function() {
OpenLayers.Control.prototype.initialize.apply(this, arguments); OpenLayers.Control.prototype.initialize.apply(this, arguments);
}, },
/** /**
* * APIMethod: destroy
*/ */
destroy: function() { destroy: function() {
@@ -58,7 +67,7 @@ OpenLayers.Control.MouseDefaults.prototype =
}, },
/** /**
* * Method: draw
*/ */
draw: function() { draw: function() {
this.map.events.register( "click", this, this.defaultClick ); this.map.events.register( "click", this, this.defaultClick );
@@ -73,7 +82,7 @@ OpenLayers.Control.MouseDefaults.prototype =
}, },
/** /**
* * Method: registerWheelEvents
*/ */
registerWheelEvents: function() { registerWheelEvents: function() {
@@ -86,9 +95,13 @@ OpenLayers.Control.MouseDefaults.prototype =
}, },
/** /**
* @param {Event} evt * Method: defaultClick
* *
* @type Boolean * Parameters:
* evt - {Event}
*
* Returns:
* {Boolean}
*/ */
defaultClick: function (evt) { defaultClick: function (evt) {
if (!OpenLayers.Event.isLeftClick(evt)) return; if (!OpenLayers.Event.isLeftClick(evt)) return;
@@ -98,7 +111,10 @@ OpenLayers.Control.MouseDefaults.prototype =
}, },
/** /**
* @param {Event} evt * Method: defaultDblClick
*
* Parameters:
* evt - {Event}
*/ */
defaultDblClick: function (evt) { defaultDblClick: function (evt) {
var newCenter = this.map.getLonLatFromViewPortPx( evt.xy ); var newCenter = this.map.getLonLatFromViewPortPx( evt.xy );
@@ -108,7 +124,10 @@ OpenLayers.Control.MouseDefaults.prototype =
}, },
/** /**
* @param {Event} evt * Method: defaultMouseDown
*
* Parameters:
* evt - {Event}
*/ */
defaultMouseDown: function (evt) { defaultMouseDown: function (evt) {
if (!OpenLayers.Event.isLeftClick(evt)) return; if (!OpenLayers.Event.isLeftClick(evt)) return;
@@ -134,7 +153,10 @@ OpenLayers.Control.MouseDefaults.prototype =
}, },
/** /**
* @param {Event} evt * Method: defaultMouseMove
*
* Parameters:
* evt - {Event}
*/ */
defaultMouseMove: function (evt) { defaultMouseMove: function (evt) {
// record the mouse position, used in onWheelEvent // record the mouse position, used in onWheelEvent
@@ -168,7 +190,10 @@ OpenLayers.Control.MouseDefaults.prototype =
}, },
/** /**
* @param {Event} evt * Method: defaultMouseUp
*
* Parameters:
* evt - {<OpenLayers.Event>}
*/ */
defaultMouseUp: function (evt) { defaultMouseUp: function (evt) {
if (!OpenLayers.Event.isLeftClick(evt)) return; if (!OpenLayers.Event.isLeftClick(evt)) return;
@@ -185,7 +210,10 @@ OpenLayers.Control.MouseDefaults.prototype =
}, },
/** /**
* @param {Event} evt * Method: defaultMouseOut
*
* Parameters:
* evt - {Event}
*/ */
defaultMouseOut: function (evt) { defaultMouseOut: function (evt) {
if (this.mouseDragStart != null && if (this.mouseDragStart != null &&
@@ -198,7 +226,9 @@ OpenLayers.Control.MouseDefaults.prototype =
}, },
/** User spun scroll wheel up /**
* Method: defaultWheelUp
* User spun scroll wheel up
* *
*/ */
defaultWheelUp: function(evt) { defaultWheelUp: function(evt) {
@@ -208,8 +238,9 @@ OpenLayers.Control.MouseDefaults.prototype =
} }
}, },
/** User spun scroll wheel down /**
* * Method: defaultWheelDown
* User spun scroll wheel down
*/ */
defaultWheelDown: function(evt) { defaultWheelDown: function(evt) {
if (this.map.getZoom() > 0) { if (this.map.getZoom() > 0) {
@@ -218,8 +249,9 @@ OpenLayers.Control.MouseDefaults.prototype =
} }
}, },
/** Zoombox function. /**
* * Method: zoomBoxEnd
* Zoombox function.
*/ */
zoomBoxEnd: function(evt) { zoomBoxEnd: function(evt) {
if (this.mouseDragStart != null) { if (this.mouseDragStart != null) {
@@ -245,6 +277,7 @@ OpenLayers.Control.MouseDefaults.prototype =
}, },
/** /**
* Method: removeZoomBox
* Remove the zoombox from the screen and nullify our reference to it. * Remove the zoombox from the screen and nullify our reference to it.
*/ */
removeZoomBox: function() { removeZoomBox: function() {
@@ -258,9 +291,12 @@ OpenLayers.Control.MouseDefaults.prototype =
*/ */
/** Catch the wheel event and handle it xbrowserly /**
* * Method: onWheelEvent
* @param {Event} e * Catch the wheel event and handle it xbrowserly
*
* Parameters:
* e - {Event}
*/ */
onWheelEvent: function(e){ onWheelEvent: function(e){
+36 -14
View File
@@ -4,46 +4,68 @@
/** /**
* @class
*
* @requires OpenLayers/Control.js * @requires OpenLayers/Control.js
*
* Class: OpenLayers.Control.MousePosition
*/ */
OpenLayers.Control.MousePosition = OpenLayers.Class.create(); OpenLayers.Control.MousePosition = OpenLayers.Class.create();
OpenLayers.Control.MousePosition.prototype = OpenLayers.Control.MousePosition.prototype =
OpenLayers.Class.inherit( OpenLayers.Control, { OpenLayers.Class.inherit( OpenLayers.Control, {
/** @type DOMElement */ /**
* Property: element
* {DOMElement}
*/
element: null, element: null,
/** @type String */ /**
* APIProperty: prefix
*/
prefix: '', prefix: '',
/** @type String */ /**
* APIProperty: seperator
* {String}
*/
separator: ', ', separator: ', ',
/** @type String */ /**
* APIProperty: suffix
* {String}
*/
suffix: '', suffix: '',
/** @type int */ /**
* APIProperty: numDigits
* {Integer}
*/
numdigits: 5, numdigits: 5,
/** @type int */ /**
* APIProperty: granularity
* {Integer}
*/
granularity: 10, granularity: 10,
/** @type OpenLayers.LonLat */ /**
* Property: lastXy
* {<OpenLayers.LonLat>}
*/
lastXy: null, lastXy: null,
/** /**
* @constructor * Constructor: OpenLayers.Control.MousePosition
* *
* @param {DOMElement} options Options for control. * Parameters:
* options - {DOMElement} Options for control.
*/ */
initialize: function(options) { initialize: function(options) {
OpenLayers.Control.prototype.initialize.apply(this, arguments); OpenLayers.Control.prototype.initialize.apply(this, arguments);
}, },
/** /**
* @type DOMElement * Method: draw
* {DOMElement}
*/ */
draw: function() { draw: function() {
OpenLayers.Control.prototype.draw.apply(this, arguments); OpenLayers.Control.prototype.draw.apply(this, arguments);
@@ -60,7 +82,7 @@ OpenLayers.Control.MousePosition.prototype =
}, },
/** /**
* * Method: redraw
*/ */
redraw: function(evt) { redraw: function(evt) {
@@ -95,7 +117,7 @@ OpenLayers.Control.MousePosition.prototype =
}, },
/** /**
* * Method: setMap
*/ */
setMap: function() { setMap: function() {
OpenLayers.Control.prototype.setMap.apply(this, arguments); OpenLayers.Control.prototype.setMap.apply(this, arguments);
+82 -23
View File
@@ -4,10 +4,12 @@
/** /**
* @class
*
* @requires OpenLayers/Control.js * @requires OpenLayers/Control.js
* @requires OpenLayers/Control/MouseDefaults.js * @requires OpenLayers/Control/MouseDefaults.js
*
* Class: OpenLayers.Control.MouseToolbar
* This class is DEPRECATED in 2.4 and will be removed by 3.0.
* If you need this functionality, use Control.NavToolbar instead!!!
*/ */
OpenLayers.Control.MouseToolbar = OpenLayers.Class.create(); OpenLayers.Control.MouseToolbar = OpenLayers.Class.create();
OpenLayers.Control.MouseToolbar.X = 6; OpenLayers.Control.MouseToolbar.X = 6;
@@ -15,19 +17,34 @@ OpenLayers.Control.MouseToolbar.Y = 300;
OpenLayers.Control.MouseToolbar.prototype = OpenLayers.Control.MouseToolbar.prototype =
OpenLayers.Class.inherit( OpenLayers.Control.MouseDefaults, { OpenLayers.Class.inherit( OpenLayers.Control.MouseDefaults, {
/** WARNING WARNING WARNING!!! /**
This class is DEPRECATED in 2.4 and will be removed by 3.0. * Property: mode
If you need this functionality, use Control.NavToolbar instead!!! */ */
mode: null, mode: null,
/**
* Property: buttons
*/
buttons: null, buttons: null,
/**
* APIProperty: direction
* {String} 'vertical' or 'horizontal'
*/
direction: "vertical", direction: "vertical",
/** @type String */ /**
* Property: buttonClicked
* {String}
*/
buttonClicked: null, buttonClicked: null,
/**
* Constructor: OpenLayers.Control.MouseToolbar
*
* Parameters:
* position - {<OpenLayers.Pixel>}
* direction - {String}
*/
initialize: function(position, direction) { initialize: function(position, direction) {
OpenLayers.Control.prototype.initialize.apply(this, arguments); OpenLayers.Control.prototype.initialize.apply(this, arguments);
this.position = new OpenLayers.Pixel(OpenLayers.Control.MouseToolbar.X, this.position = new OpenLayers.Pixel(OpenLayers.Control.MouseToolbar.X,
@@ -42,7 +59,7 @@ OpenLayers.Control.MouseToolbar.prototype =
}, },
/** /**
* * APIMethod: destroy
*/ */
destroy: function() { destroy: function() {
for( var btnId in this.buttons) { for( var btnId in this.buttons) {
@@ -54,6 +71,9 @@ OpenLayers.Control.MouseToolbar.prototype =
arguments); arguments);
}, },
/**
* Method: draw
*/
draw: function() { draw: function() {
OpenLayers.Control.prototype.draw.apply(this, arguments); OpenLayers.Control.prototype.draw.apply(this, arguments);
OpenLayers.Control.MouseDefaults.prototype.draw.apply(this, arguments); OpenLayers.Control.MouseDefaults.prototype.draw.apply(this, arguments);
@@ -68,7 +88,10 @@ OpenLayers.Control.MouseToolbar.prototype =
return this.div; return this.div;
}, },
/**
* Method: _addButton
*/
_addButton:function(id, img, activeImg, xy, sz, title) { _addButton:function(id, img, activeImg, xy, sz, title) {
var imgLocation = OpenLayers.Util.getImagesLocation() + img; var imgLocation = OpenLayers.Util.getImagesLocation() + img;
var activeImgLocation = OpenLayers.Util.getImagesLocation() + activeImg; var activeImgLocation = OpenLayers.Util.getImagesLocation() + activeImg;
@@ -97,7 +120,10 @@ OpenLayers.Control.MouseToolbar.prototype =
}, },
/** /**
* @param {Event} evt * Method: buttonDown
*
* Parameters:
* evt - {Event}
*/ */
buttonDown: function(evt) { buttonDown: function(evt) {
if (!OpenLayers.Event.isLeftClick(evt)) return; if (!OpenLayers.Event.isLeftClick(evt)) return;
@@ -106,7 +132,10 @@ OpenLayers.Control.MouseToolbar.prototype =
}, },
/** /**
* @param {Event} evt * Method: buttonUp
*
* Parameters:
* evt - {Event}
*/ */
buttonUp: function(evt) { buttonUp: function(evt) {
if (!OpenLayers.Event.isLeftClick(evt)) return; if (!OpenLayers.Event.isLeftClick(evt)) return;
@@ -120,8 +149,11 @@ OpenLayers.Control.MouseToolbar.prototype =
}, },
/** /**
* @param {Event} evt * Method: defaultDblClick
*/ *
* Parameters:
* evt - {Event}
*/
defaultDblClick: function (evt) { defaultDblClick: function (evt) {
this.switchModeTo("pan"); this.switchModeTo("pan");
this.performedDrag = false; this.performedDrag = false;
@@ -132,8 +164,11 @@ OpenLayers.Control.MouseToolbar.prototype =
}, },
/** /**
* @param {Event} evt * Method: defaultMouseDown
*/ *
* Parameters:
* evt - {Event}
*/
defaultMouseDown: function (evt) { defaultMouseDown: function (evt) {
if (!OpenLayers.Event.isLeftClick(evt)) return; if (!OpenLayers.Event.isLeftClick(evt)) return;
this.mouseDragStart = evt.xy.clone(); this.mouseDragStart = evt.xy.clone();
@@ -214,6 +249,12 @@ OpenLayers.Control.MouseToolbar.prototype =
OpenLayers.Event.stop(evt); OpenLayers.Event.stop(evt);
}, },
/**
* Method: switchModeTo
*
* Parameters:
* mode - {String}
*/
switchModeTo: function(mode) { switchModeTo: function(mode) {
if (mode != this.mode) { if (mode != this.mode) {
@@ -246,13 +287,19 @@ OpenLayers.Control.MouseToolbar.prototype =
} }
}, },
/**
* Method: leaveMode
*/
leaveMode: function() { leaveMode: function() {
this.switchModeTo("pan"); this.switchModeTo("pan");
}, },
/** /**
* @param {Event} evt * Method: defaultMouseMove
*/ *
* Parameters:
* evt - {Event}
*/
defaultMouseMove: function (evt) { defaultMouseMove: function (evt) {
if (this.mouseDragStart != null) { if (this.mouseDragStart != null) {
switch (this.mode) { switch (this.mode) {
@@ -283,8 +330,11 @@ OpenLayers.Control.MouseToolbar.prototype =
}, },
/** /**
* @param {Event} evt * Method: defaultMouseUp
*/ *
* Parameters:
* evt - {Event}
*/
defaultMouseUp: function (evt) { defaultMouseUp: function (evt) {
if (!OpenLayers.Event.isLeftClick(evt)) return; if (!OpenLayers.Event.isLeftClick(evt)) return;
switch (this.mode) { switch (this.mode) {
@@ -303,8 +353,11 @@ OpenLayers.Control.MouseToolbar.prototype =
}, },
/** /**
* @param {Event} evt * Method: defaultMouseOut
*/ *
* Parameters:
* evt - {Event}
*/
defaultMouseOut: function (evt) { defaultMouseOut: function (evt) {
if (this.mouseDragStart != null if (this.mouseDragStart != null
&& OpenLayers.Util.mouseLeft(evt, this.map.div)) { && OpenLayers.Util.mouseLeft(evt, this.map.div)) {
@@ -317,6 +370,12 @@ OpenLayers.Control.MouseToolbar.prototype =
} }
}, },
/**
* Method: defaultClick
*
* Parameters:
* evt - {Event}
*/
defaultClick: function (evt) { defaultClick: function (evt) {
if (this.performedDrag) { if (this.performedDrag) {
this.performedDrag = false; this.performedDrag = false;
+4 -2
View File
@@ -3,17 +3,18 @@
* for the full text of the license. */ * for the full text of the license. */
/** /**
* @class
*
* @requires OpenLayers/Control/Panel.js * @requires OpenLayers/Control/Panel.js
* @requires OpenLayers/Control/Navigation.js * @requires OpenLayers/Control/Navigation.js
* @requires OpenLayers/Control/ZoomBox.js * @requires OpenLayers/Control/ZoomBox.js
*
* Class: OpenLayers.Control.NavToolbar
*/ */
OpenLayers.Control.NavToolbar = OpenLayers.Class.create(); OpenLayers.Control.NavToolbar = OpenLayers.Class.create();
OpenLayers.Control.NavToolbar.prototype = OpenLayers.Control.NavToolbar.prototype =
OpenLayers.Class.inherit( OpenLayers.Control.Panel, { OpenLayers.Class.inherit( OpenLayers.Control.Panel, {
/** /**
* Constructor: OpenLayers.Control.NavToolbar
* Add our two mousedefaults controls. * Add our two mousedefaults controls.
*/ */
initialize: function(options) { initialize: function(options) {
@@ -25,6 +26,7 @@ OpenLayers.Control.NavToolbar.prototype =
}, },
/** /**
* Method: draw
* calls the default draw, and then activates mouse defaults. * calls the default draw, and then activates mouse defaults.
*/ */
draw: function() { draw: function() {
+44 -9
View File
@@ -3,25 +3,37 @@
* for the full text of the license. */ * for the full text of the license. */
/** /**
* @class
*
* @requires OpenLayers/Control/ZoomBox.js * @requires OpenLayers/Control/ZoomBox.js
* @requires OpenLayers/Control/DragPan.js * @requires OpenLayers/Control/DragPan.js
* @requires OpenLayers/Handler/MouseWheel.js * @requires OpenLayers/Handler/MouseWheel.js
*
* Class: OpenLayers.Control.Navigation
*/ */
OpenLayers.Control.Navigation = OpenLayers.Class.create(); OpenLayers.Control.Navigation = OpenLayers.Class.create();
OpenLayers.Control.Navigation.prototype = OpenLayers.Control.Navigation.prototype =
OpenLayers.Class.inherit( OpenLayers.Control, { OpenLayers.Class.inherit( OpenLayers.Control, {
/** @type OpenLayers.Control.ZoomBox */ /**
* Property: dragPan
* {<OpenLayers.Control.ZoomBox>}
*/
dragPan: null, dragPan: null,
/** @type OpenLayers.Control.ZoomBox */ /**
* Property: zoomBox
* {<OpenLayers.Control.ZoomBox>}
*/
zoomBox: null, zoomBox: null,
/** @type OpenLayers.Handler.MouseWheel */ /**
* Property: wheelHandler
* {<OpenLayers.Handler.MouseWheel>}
*/
wheelHandler: null, wheelHandler: null,
/**
* Method: activate
*/
activate: function() { activate: function() {
this.dragPan.activate(); this.dragPan.activate();
this.wheelHandler.activate(); this.wheelHandler.activate();
@@ -29,6 +41,9 @@ OpenLayers.Control.Navigation.prototype =
return OpenLayers.Control.prototype.activate.apply(this,arguments); return OpenLayers.Control.prototype.activate.apply(this,arguments);
}, },
/**
* Method: deactivate
*/
deactivate: function() { deactivate: function() {
this.zoomBox.deactivate(); this.zoomBox.deactivate();
this.dragPan.deactivate(); this.dragPan.deactivate();
@@ -36,6 +51,9 @@ OpenLayers.Control.Navigation.prototype =
return OpenLayers.Control.prototype.deactivate.apply(this,arguments); return OpenLayers.Control.prototype.deactivate.apply(this,arguments);
}, },
/**
* Method: draw
*/
draw: function() { draw: function() {
this.map.events.register( "dblclick", this, this.defaultDblClick ); this.map.events.register( "dblclick", this, this.defaultDblClick );
this.dragPan = new OpenLayers.Control.DragPan({map: this.map}); this.dragPan = new OpenLayers.Control.DragPan({map: this.map});
@@ -50,8 +68,11 @@ OpenLayers.Control.Navigation.prototype =
}, },
/** /**
* @param {Event} evt * Method: defaultDblClick
*/ *
* Parameters:
* evt - {Event}
*/
defaultDblClick: function (evt) { defaultDblClick: function (evt) {
var newCenter = this.map.getLonLatFromViewPortPx( evt.xy ); var newCenter = this.map.getLonLatFromViewPortPx( evt.xy );
this.map.setCenter(newCenter, this.map.zoom + 1); this.map.setCenter(newCenter, this.map.zoom + 1);
@@ -59,6 +80,12 @@ OpenLayers.Control.Navigation.prototype =
return false; return false;
}, },
/**
* Method: wheelChange
*
* Parameters:
* evt - {Event}
*/
wheelChange: function(evt, deltaZ) { wheelChange: function(evt, deltaZ) {
var newZoom = this.map.getZoom() + deltaZ; var newZoom = this.map.getZoom() + deltaZ;
if (!this.map.isValidZoomLevel(newZoom)) return; if (!this.map.isValidZoomLevel(newZoom)) return;
@@ -74,15 +101,23 @@ OpenLayers.Control.Navigation.prototype =
this.map.setCenter( newCenter, newZoom ); this.map.setCenter( newCenter, newZoom );
}, },
/** User spun scroll wheel up /**
* Method: wheelUp
* User spun scroll wheel up
* *
* Parameters:
* evt - {Event}
*/ */
wheelUp: function(evt) { wheelUp: function(evt) {
this.wheelChange(evt, 1); this.wheelChange(evt, 1);
}, },
/** User spun scroll wheel down /**
* Method: wheelDown
* User spun scroll wheel down
* *
* Parameters:
* evt - {Event}
*/ */
wheelDown: function(evt) { wheelDown: function(evt) {
this.wheelChange(evt, -1); this.wheelChange(evt, -1);
+170 -87
View File
@@ -1,78 +1,88 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt * See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
* for the full text of the license. */ * for the full text of the license. */
/**
* @fileoverview Locator Map Control
* @author Tim Schaub
*/
/** /**
* @class
*
* @requires OpenLayers/Control.js * @requires OpenLayers/Control.js
* @requires OpenLayers/BaseTypes.js * @requires OpenLayers/BaseTypes.js
* @requires OpenLayers/Events.js * @requires OpenLayers/Events.js
*
* Class: OpenLayers.Control.OverviewMap
* Create an overview map to display the extent of your main map and provide
* additional navigation control. Create a new overview map with the
* <OpenLayers.Control.OverviewMap> constructor.
*
* Inerits from:
* - <OpenLayers.Control>
*/ */
OpenLayers.Control.OverviewMap = OpenLayers.Class.create(); OpenLayers.Control.OverviewMap = OpenLayers.Class.create();
OpenLayers.Control.OverviewMap.prototype = OpenLayers.Control.OverviewMap.prototype =
OpenLayers.Class.inherit( OpenLayers.Control, { OpenLayers.Class.inherit( OpenLayers.Control, {
/** For div.id /**
* @type String */ * Property: id
* {String} For div.id
*/
id: "OverviewMap", id: "OverviewMap",
/** @type DOMElement */ /**
* Property: element
* {DOMElement} The DOM element that contains the overview map
*/
element: null, element: null,
/** /**
* The overvew map itself. * APIProperty: ovmap
* @type OpenLayers.Map * {<OpenLayers.Map>} A reference to the overvew map itself.
*/ */
ovmap: null, ovmap: null,
/** /**
* The overvew map size in pixels. Note that this is the size of the map * APIProperty: size
* itself - the element that contains the map (default class name * {<OpenLayers.Size>} The overvew map size in pixels. Note that this is
* olControlOverviewMapElement) may have padding or other style attributes * the size of the map itself - the element that contains the map (default
* added via CSS. * class name olControlOverviewMapElement) may have padding or other style
* @type OpenLayers.Size * attributes added via CSS.
*/ */
size: new OpenLayers.Size(180, 90), size: new OpenLayers.Size(180, 90),
/** /**
* Ordered list of layers in the overview map. If none are sent at * APIProperty: layers
* construction, then the default below is used. * {Array(<OpenLayers.Layer>)} Ordered list of layers in the overview map.
* * If none are sent at construction, the base layer for the main map is used.
* @type Array(OpenLayers.Layer)
*/ */
layers: null, layers: null,
/** /**
* The ratio of the overview map resolution to the main map resolution * APIProperty: minRatio
* at which to zoom farther out on the overview map. * {Numver} The ratio of the overview map resolution to the main map
* @type Float * resolution at which to zoom farther out on the overview map.
*/ */
minRatio: 8, minRatio: 8,
/** /**
* The ratio of the overview map resolution to the main map resolution * APIProperty: maxRatio
* at which to zoom farther in on the overview map. * {Float} The ratio of the overview map resolution to the main map
* @type Float * resolution at which to zoom farther in on the overview map.
*/ */
maxRatio: 32, maxRatio: 32,
/** /**
* An object containing any non-default properties to be sent to the * APIProperty: mapOptions
* overview map's map constructor. These should include any non-default * {Object} An object containing any non-default properties to be sent to
* the overview map's map constructor. These should include any non-default
* options that the main map was constructed with. * options that the main map was constructed with.
* @type: Object
*/ */
mapOptions: null, mapOptions: null,
/** /**
* @constructor * Constructor: OpenLayers.Control.OverviewMap
* @param {Object} options Hashtable of options to set on the overview map * Create a new overview map
*
* Parameters:
* object - {Object} Properties of this object will be set on the overview
* map object. Note, to set options on the map object contained in this
* control, set <mapOptions> as one of the options properties.
*/ */
initialize: function(options) { initialize: function(options) {
this.layers = new Array(); this.layers = new Array();
@@ -80,7 +90,8 @@ OpenLayers.Control.OverviewMap.prototype =
}, },
/** /**
* * APIMethod: destroy
* Deconstruct the control
*/ */
destroy: function() { destroy: function() {
if (!this.mapDiv) { // we've already been destroyed if (!this.mapDiv) { // we've already been destroyed
@@ -124,7 +135,8 @@ OpenLayers.Control.OverviewMap.prototype =
}, },
/** /**
* @type DOMElement * Method: draw
* Render the control in the browser.
*/ */
draw: function() { draw: function() {
OpenLayers.Control.prototype.draw.apply(this, arguments); OpenLayers.Control.prototype.draw.apply(this, arguments);
@@ -249,14 +261,22 @@ OpenLayers.Control.OverviewMap.prototype =
return this.div; return this.div;
}, },
/**
* Method: baseLayerDraw
* Draw the base layer - called if unable to complete in the initial draw
*/
baseLayerDraw: function() { baseLayerDraw: function() {
this.draw(); this.draw();
this.map.events.unregister("changebaselayer", this, this.baseLayerDraw); this.map.events.unregister("changebaselayer", this, this.baseLayerDraw);
}, },
/** /**
* @param {OpenLayers.Event} evt * Method: rectMouseOut
*/ * Handle browser events
*
* Parameters:
* evt - {<OpenLayers.Event>} evt
*/
rectMouseOut: function (evt) { rectMouseOut: function (evt) {
if(this.rectDragStart != null) { if(this.rectDragStart != null) {
if(this.performedRectDrag) { if(this.performedRectDrag) {
@@ -278,8 +298,12 @@ OpenLayers.Control.OverviewMap.prototype =
}, },
/** /**
* @param {OpenLayers.Event} evt * Method: rectMouseDown
*/ * Handle browser events
*
* Parameters:
* evt - {<OpenLayers.Event>} evt
*/
rectMouseDown: function (evt) { rectMouseDown: function (evt) {
if(!OpenLayers.Event.isLeftClick(evt)) return; if(!OpenLayers.Event.isLeftClick(evt)) return;
this.rectDragStart = evt.xy.clone(); this.rectDragStart = evt.xy.clone();
@@ -288,8 +312,12 @@ OpenLayers.Control.OverviewMap.prototype =
}, },
/** /**
* @param {OpenLayers.Event} evt * Method: rectMouseMove
*/ * Handle browser events
*
* Parameters:
* evt - {<OpenLayers.Event>} evt
*/
rectMouseMove: function(evt) { rectMouseMove: function(evt) {
if(this.rectDragStart != null) { if(this.rectDragStart != null) {
var deltaX = this.rectDragStart.x - evt.xy.x; var deltaX = this.rectDragStart.x - evt.xy.x;
@@ -317,8 +345,12 @@ OpenLayers.Control.OverviewMap.prototype =
}, },
/** /**
* @param {OpenLayers.Event} evt * Method: rectMouseUp
*/ * Handle browser events
*
* Parameters:
* evt - {<OpenLayers.Event>} evt
*/
rectMouseUp: function(evt) { rectMouseUp: function(evt) {
if(!OpenLayers.Event.isLeftClick(evt)) return; if(!OpenLayers.Event.isLeftClick(evt)) return;
if(this.performedRectDrag) { if(this.performedRectDrag) {
@@ -330,8 +362,12 @@ OpenLayers.Control.OverviewMap.prototype =
}, },
/** /**
* @param {OpenLayers.Event} evt * Method: rectDblClick
*/ * Handle browser events
*
* Parameters:
* evt - {<OpenLayers.Event>} evt
*/
rectDblClick: function(evt) { rectDblClick: function(evt) {
this.performedRectDrag = false; this.performedRectDrag = false;
OpenLayers.Event.stop(evt); OpenLayers.Event.stop(evt);
@@ -339,8 +375,12 @@ OpenLayers.Control.OverviewMap.prototype =
}, },
/** /**
* @param {OpenLayers.Event} evt * Method: mapDivClick
*/ * Handle browser events
*
* Parameters:
* evt - {<OpenLayers.Event>} evt
*/
mapDivClick: function(evt) { mapDivClick: function(evt) {
var pxBounds = this.getRectPxBounds(); var pxBounds = this.getRectPxBounds();
var pxCenter = pxBounds.getCenterPixel(); var pxCenter = pxBounds.getCenterPixel();
@@ -362,9 +402,12 @@ OpenLayers.Control.OverviewMap.prototype =
OpenLayers.Event.stop(evt); OpenLayers.Event.stop(evt);
}, },
/** Set up the labels and divs for the control /**
* * Method: maximizeControl
* @param {OpenLayers.Event} e * Unhide the control. Called when the control is in the map viewport.
*
* Parameters:
* e - {<OpenLayers.Event>}
*/ */
maximizeControl: function(e) { maximizeControl: function(e) {
this.element.style.display = ''; this.element.style.display = '';
@@ -374,10 +417,13 @@ OpenLayers.Control.OverviewMap.prototype =
} }
}, },
/** Hide all the contents of the control, shrink the size, /**
* add the maximize icon * Method: minimizeControl
* Hide all the contents of the control, shrink the size,
* add the maximize icon
* *
* @param {OpenLayers.Event} e * Parameters:
* e - {<OpenLayers.Event>}
*/ */
minimizeControl: function(e) { minimizeControl: function(e) {
this.element.style.display = 'none'; this.element.style.display = 'none';
@@ -387,12 +433,12 @@ OpenLayers.Control.OverviewMap.prototype =
} }
}, },
/** Hide/Show all LayerSwitcher controls depending on whether we are /**
* minimized or not * Method: showToggle
* * Hide/Show the toggle depending on whether the control is minimized
* @private *
* * Parameters:
* @param {Boolean} minimize * minimize - {Boolean}
*/ */
showToggle: function(minimize) { showToggle: function(minimize) {
this.maximizeDiv.style.display = minimize ? '' : 'none'; this.maximizeDiv.style.display = minimize ? '' : 'none';
@@ -400,6 +446,7 @@ OpenLayers.Control.OverviewMap.prototype =
}, },
/** /**
* Method: update
* Update the overview map after layers move. * Update the overview map after layers move.
*/ */
update: function() { update: function() {
@@ -416,6 +463,7 @@ OpenLayers.Control.OverviewMap.prototype =
}, },
/** /**
* Method: isSuitableOverview
* Determines if the overview map is suitable given the extent and * Determines if the overview map is suitable given the extent and
* resolution of the main map. * resolution of the main map.
*/ */
@@ -433,6 +481,10 @@ OpenLayers.Control.OverviewMap.prototype =
(this.ovmap.getExtent().containsBounds(testExtent))); (this.ovmap.getExtent().containsBounds(testExtent)));
}, },
/**
* Method updateOverview
* Called by <update> if <isSuitableOverview> returns true
*/
updateOverview: function() { updateOverview: function() {
var mapRes = this.map.getResolution(); var mapRes = this.map.getResolution();
var targetRes = this.ovmap.getResolution(); var targetRes = this.ovmap.getResolution();
@@ -449,6 +501,10 @@ OpenLayers.Control.OverviewMap.prototype =
this.updateRectToMap(); this.updateRectToMap();
}, },
/**
* Method: createMap
* Construct the map that this control contains
*/
createMap: function() { createMap: function() {
// create the overview map // create the overview map
var options = OpenLayers.Util.extend( var options = OpenLayers.Util.extend(
@@ -470,6 +526,7 @@ OpenLayers.Control.OverviewMap.prototype =
}, },
/** /**
* Method: updateRectToMap
* Updates the extent rectangle position and size to match the map extent * Updates the extent rectangle position and size to match the map extent
*/ */
updateRectToMap: function() { updateRectToMap: function() {
@@ -487,6 +544,7 @@ OpenLayers.Control.OverviewMap.prototype =
}, },
/** /**
* Method: updateMapToRect
* Updates the map extent to match the extent rectangle position and size * Updates the map extent to match the extent rectangle position and size
*/ */
updateMapToRect: function() { updateMapToRect: function() {
@@ -496,9 +554,12 @@ OpenLayers.Control.OverviewMap.prototype =
}, },
/** /**
* Method: getRectPxBounds
* Get extent rectangle pixel bounds * Get extent rectangle pixel bounds
* @returns An OpenLayers.Bounds wich is the extent rectangle's pixel *
* bounds (relative to the parent element) * Return:
* {<OpenLayers.Bounds>} A bounds which is the extent rectangle's pixel
* bounds (relative to the parent element)
*/ */
getRectPxBounds: function() { getRectPxBounds: function() {
var top = parseInt(this.extentRectangle.style.top); var top = parseInt(this.extentRectangle.style.top);
@@ -509,8 +570,11 @@ OpenLayers.Control.OverviewMap.prototype =
}, },
/** /**
* Set extent rectangle pixel bounds. * Method: setRectPxBounds
* @param {OpenLayers.Bounds} pxBounds * Set extent rectangle pixel bounds.
*
* Parameters:
* pxBounds - {<OpenLayers.Bounds>}
*/ */
setRectPxBounds: function(pxBounds) { setRectPxBounds: function(pxBounds) {
var top = Math.max(pxBounds.top, 0); var top = Math.max(pxBounds.top, 0);
@@ -526,12 +590,16 @@ OpenLayers.Control.OverviewMap.prototype =
}, },
/** /**
* @param {OpenLayers.Bounds} lonLatBounds * Method: getRectBoundsFromMapBounds
* * Get the rect bounds from the map bounds.
* @returns An OpenLayers.Bounds which is the passed-in map lon/lat extent *
* translated into pixel bounds for the overview map * Parameters:
* @type OpenLayers.Bounds * lonLatBounds - {<OpenLayers.Bounds>}
*/ *
* Return:
* {<OpenLayers.Bounds>}A bounds which is the passed-in map lon/lat extent
* translated into pixel bounds for the overview map
*/
getRectBoundsFromMapBounds: function(lonLatBounds) { getRectBoundsFromMapBounds: function(lonLatBounds) {
var leftBottomLonLat = new OpenLayers.LonLat(lonLatBounds.left, var leftBottomLonLat = new OpenLayers.LonLat(lonLatBounds.left,
lonLatBounds.bottom); lonLatBounds.bottom);
@@ -548,12 +616,16 @@ OpenLayers.Control.OverviewMap.prototype =
}, },
/** /**
* @param {OpenLayers.Bounds} pxBounds * Method: getMapBoundsFromRectBounds
* * Get the map bounds from the rect bounds.
* @returns An OpenLayers.Bounds which is the passed-in overview rect bounds *
* translated into lon/lat bounds for the overview map * Parameters:
* @type OpenLayers.Bounds * pxBounds - {<OpenLayers.Bounds>}
*/ *
* Return:
* {<OpenLayers.Bounds>} Bounds which is the passed-in overview rect bounds
* translated into lon/lat bounds for the overview map
*/
getMapBoundsFromRectBounds: function(pxBounds) { getMapBoundsFromRectBounds: function(pxBounds) {
var leftBottomPx = new OpenLayers.Pixel(pxBounds.left, var leftBottomPx = new OpenLayers.Pixel(pxBounds.left,
pxBounds.bottom); pxBounds.bottom);
@@ -566,12 +638,16 @@ OpenLayers.Control.OverviewMap.prototype =
}, },
/** /**
* @param {OpenLayers.Pixel} overviewMapPx * Method: getLonLatFromOverviewPx
* * Get a map location from a pixel location
* @returns An OpenLayers.LonLat which is the passed-in overview map *
* OpenLayers.Pixel, translated into lon/lat by the overview map * Parameters:
* @type OpenLayers.LonLat * overviewMapPx - {<OpenLayers.Pixel>}
*/ *
* Return:
* {<OpenLayers.LonLat>} Location which is the passed-in overview map
* OpenLayers.Pixel, translated into lon/lat by the overview map
*/
getLonLatFromOverviewPx: function(overviewMapPx) { getLonLatFromOverviewPx: function(overviewMapPx) {
var size = this.ovmap.size; var size = this.ovmap.size;
var res = this.ovmap.getResolution(); var res = this.ovmap.getResolution();
@@ -585,12 +661,16 @@ OpenLayers.Control.OverviewMap.prototype =
}, },
/** /**
* @param {OpenLayers.LonLat} lonlat * Method: getOverviewPxFromLonLat
* * Get a pixel location from a map location
* @returns An OpenLayers.Pixel which is the passed-in OpenLayers.LonLat, *
* translated into overview map pixels * Parameters:
* @type OpenLayers.Pixel * lonlat - {<OpenLayers.LonLat>}
*/ *
* Return:
* {<OpenLayers.Pixel>} Location which is the passed-in OpenLayers.LonLat,
* translated into overview map pixels
*/
getOverviewPxFromLonLat: function(lonlat) { getOverviewPxFromLonLat: function(lonlat) {
var res = this.ovmap.getResolution(); var res = this.ovmap.getResolution();
var extent = this.ovmap.getExtent(); var extent = this.ovmap.getExtent();
@@ -603,7 +683,10 @@ OpenLayers.Control.OverviewMap.prototype =
return px; return px;
}, },
/** @final @type String */ /**
* Constant: CLASS_NAME
* {String} Name of this class
*/
CLASS_NAME: 'OpenLayers.Control.OverviewMap' CLASS_NAME: 'OpenLayers.Control.OverviewMap'
}); });
+45 -22
View File
@@ -4,9 +4,12 @@
/** /**
* @class
*
* @requires OpenLayers/Control.js * @requires OpenLayers/Control.js
*
* Class: OpenLayers.PanZoom
*
* Inherits from:
* - <OpenLayers.Control>
*/ */
OpenLayers.Control.PanZoom = OpenLayers.Class.create(); OpenLayers.Control.PanZoom = OpenLayers.Class.create();
OpenLayers.Control.PanZoom.X = 4; OpenLayers.Control.PanZoom.X = 4;
@@ -14,17 +17,26 @@ OpenLayers.Control.PanZoom.Y = 4;
OpenLayers.Control.PanZoom.prototype = OpenLayers.Control.PanZoom.prototype =
OpenLayers.Class.inherit( OpenLayers.Control, { OpenLayers.Class.inherit( OpenLayers.Control, {
/** @type int */ /**
* APIProperty: slideFactor
* {Float}
*/
slideFactor: 50, slideFactor: 50,
/** @type Array of Button Divs */ /**
* Property: buttons
* Array of Button Divs
*/
buttons: null, buttons: null,
/** @type OpenLayers.Pixel */ /**
* Property: position
* {<OpenLayers.Pixel>}
*/
position: null, position: null,
/** /**
* @constructor * Constructor: OpenLayers.PanZoom
*/ */
initialize: function() { initialize: function() {
this.position = new OpenLayers.Pixel(OpenLayers.Control.PanZoom.X, this.position = new OpenLayers.Pixel(OpenLayers.Control.PanZoom.X,
@@ -33,7 +45,7 @@ OpenLayers.Control.PanZoom.prototype =
}, },
/** /**
* * APIMethod: destroy
*/ */
destroy: function() { destroy: function() {
OpenLayers.Control.prototype.destroy.apply(this, arguments); OpenLayers.Control.prototype.destroy.apply(this, arguments);
@@ -47,10 +59,13 @@ OpenLayers.Control.PanZoom.prototype =
}, },
/** /**
* @param {OpenLayers.Pixel} px * Method: draw
*
* Parameters:
* px - {<OpenLayers.Pixel>}
* *
* @returns A reference to the container div for the PanZoom control * Returns:
* @type DOMElement * {DOMElement} A reference to the container div for the PanZoom control
*/ */
draw: function(px) { draw: function(px) {
// initialize our internal div // initialize our internal div
@@ -79,15 +94,17 @@ OpenLayers.Control.PanZoom.prototype =
}, },
/** /**
* @param {String} id * Method: _addButton
* @param {String} img
* @param {OpenLayers.Pixel} xy
* @param {OpenLayers.Size} sz
* *
* @returns A Div (an alphaImageDiv, to be precise) that contains the * Parameters:
* image of the button, and has all the proper event handlers * id - {String}
* set. * img - {String}
* @type DOMElement * xy - {<OpenLayers.Pixel>}
* sz - {<OpenLayers.Size>}
*
* Returns:
* {DOMElement} A Div (an alphaImageDiv, to be precise) that contains the
* image of the button, and has all the proper event handlers set.
*/ */
_addButton:function(id, img, xy, sz) { _addButton:function(id, img, xy, sz) {
var imgLocation = OpenLayers.Util.getImagesLocation() + img; var imgLocation = OpenLayers.Util.getImagesLocation() + img;
@@ -116,9 +133,12 @@ OpenLayers.Control.PanZoom.prototype =
}, },
/** /**
* @param {Event} evt * Method: doubleClick
* *
* @type Boolean * Parameters:
* evt - {Event}
*
* Returns: {Boolean}
*/ */
doubleClick: function (evt) { doubleClick: function (evt) {
OpenLayers.Event.stop(evt); OpenLayers.Event.stop(evt);
@@ -126,7 +146,10 @@ OpenLayers.Control.PanZoom.prototype =
}, },
/** /**
* @param {Event} evt * Method: buttonDown
*
* Parameters:
* evt - {Event}
*/ */
buttonDown: function (evt) { buttonDown: function (evt) {
if (!OpenLayers.Event.isLeftClick(evt)) return; if (!OpenLayers.Event.isLeftClick(evt)) return;
+74 -26
View File
@@ -4,38 +4,60 @@
/** /**
* @class
*
* @requires OpenLayers/Control/PanZoom.js * @requires OpenLayers/Control/PanZoom.js
*
* Class: OpenLayers.Control.PanZoomBar
*
* Inherits from:
* - <OpenLayers.Control.PanZoom>
* - <OpenLayers.Control>
*/ */
OpenLayers.Control.PanZoomBar = OpenLayers.Class.create(); OpenLayers.Control.PanZoomBar = OpenLayers.Class.create();
OpenLayers.Control.PanZoomBar.prototype = OpenLayers.Control.PanZoomBar.prototype =
OpenLayers.Class.inherit( OpenLayers.Control.PanZoom, { OpenLayers.Class.inherit( OpenLayers.Control.PanZoom, {
/** @type int */ /**
* APIProperty: zoomStopWidth
*/
zoomStopWidth: 18, zoomStopWidth: 18,
/** @type int */ /**
* APIProperty: zoomStopHeight
*/
zoomStopHeight: 11, zoomStopHeight: 11,
/** @type DOMElement */ /**
* Property: slider
*/
slider: null, slider: null,
/** @type OpenLayers.Events */ /**
* Property: sliderEvents
* {<OpenLayers.Events>}
*/
sliderEvents: null, sliderEvents: null,
/** @type DOMElement */ /**
* Property: zoomBarDiv
* {DOMElement}
*/
zoomBarDiv: null, zoomBarDiv: null,
/** @type OpenLayers.Events */ /**
* Property: divEvents
* {<OpenLayers.Events>}
*/
divEvents: null, divEvents: null,
/**
* Constructor: <OpenLayers.Control.PanZoomBar>
*/
initialize: function() { initialize: function() {
OpenLayers.Control.PanZoom.prototype.initialize.apply(this, arguments); OpenLayers.Control.PanZoom.prototype.initialize.apply(this, arguments);
}, },
/** /**
* * APIMethod: destroy
*/ */
destroy: function() { destroy: function() {
@@ -58,15 +80,19 @@ OpenLayers.Control.PanZoomBar.prototype =
}, },
/** /**
* @param {OpenLayers.Map} map * Method: setMap
*
* Parameters:
* map - {<OpenLayers.Map>}
*/ */
setMap: function(map) { setMap: function(map) {
OpenLayers.Control.PanZoom.prototype.setMap.apply(this, arguments); OpenLayers.Control.PanZoom.prototype.setMap.apply(this, arguments);
this.map.events.register("changebaselayer", this, this.redraw); this.map.events.register("changebaselayer", this, this.redraw);
}, },
/** clear the div and start over. /**
* * Method: redraw
* clear the div and start over.
*/ */
redraw: function() { redraw: function() {
if (this.div != null) { if (this.div != null) {
@@ -76,7 +102,10 @@ OpenLayers.Control.PanZoomBar.prototype =
}, },
/** /**
* @param {OpenLayers.Pixel} px * Method: draw
*
* Parameters:
* px - {<OpenLayers.Pixel>}
*/ */
draw: function(px) { draw: function(px) {
// initialize our internal div // initialize our internal div
@@ -101,7 +130,10 @@ OpenLayers.Control.PanZoomBar.prototype =
}, },
/** /**
* @param {OpenLayers.Pixel} location where zoombar drawing is to start. * Method: _addZoomBar
*
* Parameters:
* location - {<OpenLayers.Pixel>} where zoombar drawing is to start.
*/ */
_addZoomBar:function(centered) { _addZoomBar:function(centered) {
var imgLocation = OpenLayers.Util.getImagesLocation(); var imgLocation = OpenLayers.Util.getImagesLocation();
@@ -162,17 +194,22 @@ OpenLayers.Control.PanZoomBar.prototype =
this.zoomStopHeight * this.map.getNumZoomLevels()); this.zoomStopHeight * this.map.getNumZoomLevels());
return centered; return centered;
}, },
/*
/*
* Method: passEventToSlider
* This function is used to pass events that happen on the div, or the map, * This function is used to pass events that happen on the div, or the map,
* through to the slider, which then does its moving thing. * through to the slider, which then does its moving thing.
* @param {OpenLayers.Event} evt *
* Parameters:
* evt - {<OpenLayers.Event>}
*/ */
passEventToSlider:function(evt) { passEventToSlider:function(evt) {
this.sliderEvents.handleBrowserEvent(evt); this.sliderEvents.handleBrowserEvent(evt);
}, },
/* /*
* divClick: Picks up on clicks directly on the zoombar div * Method: divClick
* Picks up on clicks directly on the zoombar div
* and sets the zoom level appropriately. * and sets the zoom level appropriately.
*/ */
divClick: function (evt) { divClick: function (evt) {
@@ -184,9 +221,12 @@ OpenLayers.Control.PanZoomBar.prototype =
OpenLayers.Event.stop(evt); OpenLayers.Event.stop(evt);
}, },
/* /*
* Method: zoomBarDown
* event listener for clicks on the slider * event listener for clicks on the slider
* @param {OpenLayers.Event} evt *
* Parameters:
* evt - {<OpenLayers.Event>}
*/ */
zoomBarDown:function(evt) { zoomBarDown:function(evt) {
if (!OpenLayers.Event.isLeftClick(evt)) return; if (!OpenLayers.Event.isLeftClick(evt)) return;
@@ -201,10 +241,14 @@ OpenLayers.Control.PanZoomBar.prototype =
}, },
/* /*
* This is what happens when a click has occurred, and the client is dragging. * Method: zoomBarDrag
* Here we must ensure that the slider doesn't go beyond the bottom/top of the * This is what happens when a click has occurred, and the client is
* zoombar div, as well as moving the slider to its new visual location * dragging. Here we must ensure that the slider doesn't go beyond the
* @param {OpenLayers.Event} evt * bottom/top of the zoombar div, as well as moving the slider to its new
* visual location
*
* Parameters:
* evt - {<OpenLayers.Event>}
*/ */
zoomBarDrag:function(evt) { zoomBarDrag:function(evt) {
if (this.mouseDragStart != null) { if (this.mouseDragStart != null) {
@@ -220,10 +264,13 @@ OpenLayers.Control.PanZoomBar.prototype =
} }
}, },
/* /*
* Method: zoomBarUp
* Perform cleanup when a mouseup event is received -- discover new zoom * Perform cleanup when a mouseup event is received -- discover new zoom
* level and switch to it. * level and switch to it.
* @param {OpenLayers.Event} evt *
* Parameters:
* evt - {<OpenLayers.Event>}
*/ */
zoomBarUp:function(evt) { zoomBarUp:function(evt) {
if (!OpenLayers.Event.isLeftClick(evt)) return; if (!OpenLayers.Event.isLeftClick(evt)) return;
@@ -239,7 +286,8 @@ OpenLayers.Control.PanZoomBar.prototype =
} }
}, },
/* /*
* Method: moveZoomBar
* Change the location of the slider to match the current zoom level. * Change the location of the slider to match the current zoom level.
*/ */
moveZoomBar:function() { moveZoomBar:function() {
+41 -13
View File
@@ -3,36 +3,44 @@
* for the full text of the license. */ * for the full text of the license. */
/** /**
* @class
*
* @requires OpenLayers/Control.js * @requires OpenLayers/Control.js
*
* Class: OpenLayers.Control.Panel
*
* Inherits from:
* - <OpenLayers.Control>
*/ */
OpenLayers.Control.Panel = OpenLayers.Class.create(); OpenLayers.Control.Panel = OpenLayers.Class.create();
OpenLayers.Control.Panel.prototype = OpenLayers.Control.Panel.prototype =
OpenLayers.Class.inherit( OpenLayers.Control, { OpenLayers.Class.inherit( OpenLayers.Control, {
/** /**
* @type Array(OpenLayers.Control) * Property: controls
* Array({<OpenLayers.Control>})
*/ */
controls: null, controls: null,
/** /**
* The control which is activated when the control is activated (turned * APIProperty: defaultControl
* on), which also happens at instantiation. * <OpenLayers.Control> The control which is activated when the control is
* @type OpenLayers.Control * activated (turned on), which also happens at instantiation.
*/ */
defaultControl: null, defaultControl: null,
/** /**
* @constructor * Constructor: OpenLayers.Control
* *
* @param {DOMElement} element * Parameters:
* @param {String} base * element - {DOMElement}
* base - {String}
*/ */
initialize: function(element) { initialize: function(element) {
OpenLayers.Control.prototype.initialize.apply(this, arguments); OpenLayers.Control.prototype.initialize.apply(this, arguments);
this.controls = []; this.controls = [];
}, },
/**
* APIMethod: destroy
*/
destroy: function() { destroy: function() {
OpenLayers.Control.prototype.destroy.apply(this, arguments); OpenLayers.Control.prototype.destroy.apply(this, arguments);
for(var i = this.controls.length - 1 ; i >= 0; i--) { for(var i = this.controls.length - 1 ; i >= 0; i--) {
@@ -41,6 +49,9 @@ OpenLayers.Control.Panel.prototype =
} }
}, },
/**
* APIMethod: activate
*/
activate: function() { activate: function() {
if (OpenLayers.Control.prototype.activate.apply(this, arguments)) { if (OpenLayers.Control.prototype.activate.apply(this, arguments)) {
for(var i = 0; i < this.controls.length; i++) { for(var i = 0; i < this.controls.length; i++) {
@@ -55,6 +66,9 @@ OpenLayers.Control.Panel.prototype =
} }
}, },
/**
* APIMethod: deactivate
*/
deactivate: function() { deactivate: function() {
if (OpenLayers.Control.prototype.deactivate.apply(this, arguments)) { if (OpenLayers.Control.prototype.deactivate.apply(this, arguments)) {
for(var i = 0; i < this.controls.length; i++) { for(var i = 0; i < this.controls.length; i++) {
@@ -68,7 +82,9 @@ OpenLayers.Control.Panel.prototype =
}, },
/** /**
* @type DOMElement * Method: draw
*
* Returns: {DOMElement}
*/ */
draw: function() { draw: function() {
OpenLayers.Control.prototype.draw.apply(this, arguments); OpenLayers.Control.prototype.draw.apply(this, arguments);
@@ -81,7 +97,7 @@ OpenLayers.Control.Panel.prototype =
}, },
/** /**
* @private * Method: redraw
*/ */
redraw: function() { redraw: function() {
this.div.innerHTML = ""; this.div.innerHTML = "";
@@ -98,6 +114,12 @@ OpenLayers.Control.Panel.prototype =
} }
}, },
/**
* APIMethod: activateControl
*
* Parameters:
* control - {<OpenLayers.Control>}
*/
activateControl: function (control) { activateControl: function (control) {
if (!this.active) { return false; } if (!this.active) { return false; }
if (control.type == OpenLayers.Control.TYPE_BUTTON) { if (control.type == OpenLayers.Control.TYPE_BUTTON) {
@@ -125,10 +147,13 @@ OpenLayers.Control.Panel.prototype =
}, },
/** /**
* APIMethod: addControls
* To build a toolbar, you add a set of controls to it. addControls * To build a toolbar, you add a set of controls to it. addControls
* lets you add a single control or a list of controls to the * lets you add a single control or a list of controls to the
* Control Panel. * Control Panel.
* @param {OpenLayers.Control} controls *
* Parameters:
* controls - {<OpenLayers.Control>}
*/ */
addControls: function(controls) { addControls: function(controls) {
if (!(controls instanceof Array)) { if (!(controls instanceof Array)) {
@@ -159,7 +184,10 @@ OpenLayers.Control.Panel.prototype =
this.redraw(); this.redraw();
} }
}, },
/**
* Method: onClick
*/
onClick: function (ctrl, evt) { onClick: function (ctrl, evt) {
OpenLayers.Event.stop(evt ? evt : window.event); OpenLayers.Event.stop(evt ? evt : window.event);
this.activateControl(ctrl); this.activateControl(ctrl);
+28 -13
View File
@@ -4,25 +4,35 @@
/** /**
* @class
*
* @requires OpenLayers/Control.js * @requires OpenLayers/Control.js
*
* Class: OpenLayers.Control.Permalink
*
* Inherits from:
* - <OpenLayers.Control>
*/ */
OpenLayers.Control.Permalink = OpenLayers.Class.create(); OpenLayers.Control.Permalink = OpenLayers.Class.create();
OpenLayers.Control.Permalink.prototype = OpenLayers.Control.Permalink.prototype =
OpenLayers.Class.inherit( OpenLayers.Control, { OpenLayers.Class.inherit( OpenLayers.Control, {
/** @type DOMElement */ /**
* Property: element
* {DOMElement}
*/
element: null, element: null,
/** @type String */ /**
* APIProperty: base
* {String}
*/
base: '', base: '',
/** /**
* @constructor * Constructor: OpenLayers.Control.Permalink
* *
* @param {DOMElement} element * Parameters:
* @param {String} base * element - {DOMElement}
* base - {String}
*/ */
initialize: function(element, base) { initialize: function(element, base) {
OpenLayers.Control.prototype.initialize.apply(this, arguments); OpenLayers.Control.prototype.initialize.apply(this, arguments);
@@ -33,7 +43,7 @@ OpenLayers.Control.Permalink.prototype =
}, },
/** /**
* * APIMethod: destroy
*/ */
destroy: function() { destroy: function() {
if (this.element.parentNode == this.div) { if (this.element.parentNode == this.div) {
@@ -46,9 +56,12 @@ OpenLayers.Control.Permalink.prototype =
OpenLayers.Control.prototype.destroy.apply(this, arguments); OpenLayers.Control.prototype.destroy.apply(this, arguments);
}, },
/** Set the map property for the control. /**
* Method: setMap
* Set the map property for the control.
* *
* @param {OpenLayers.Map} map * Parameters:
* map - {<OpenLayers.Map>}
*/ */
setMap: function(map) { setMap: function(map) {
OpenLayers.Control.prototype.setMap.apply(this, arguments); OpenLayers.Control.prototype.setMap.apply(this, arguments);
@@ -67,7 +80,9 @@ OpenLayers.Control.Permalink.prototype =
}, },
/** /**
* @type DOMElement * Method: draw
*
* Returns: {DOMElement}
*/ */
draw: function() { draw: function() {
OpenLayers.Control.prototype.draw.apply(this, arguments); OpenLayers.Control.prototype.draw.apply(this, arguments);
@@ -85,7 +100,7 @@ OpenLayers.Control.Permalink.prototype =
}, },
/** /**
* * Method: updateLink
*/ */
updateLink: function() { updateLink: function() {
var center = this.map.getCenter(); var center = this.map.getCenter();
+18 -8
View File
@@ -4,21 +4,29 @@
/** /**
* @class
*
* @requires OpenLayers/Control.js * @requires OpenLayers/Control.js
*
* Class: OpenLayers.Control.Scale
* Display a small scale indicator on the map.
* Inherits from:
* - <OpenLayers.Control>
*/ */
OpenLayers.Control.Scale = OpenLayers.Class.create(); OpenLayers.Control.Scale = OpenLayers.Class.create();
OpenLayers.Control.Scale.prototype = OpenLayers.Control.Scale.prototype =
OpenLayers.Class.inherit( OpenLayers.Control, { OpenLayers.Class.inherit( OpenLayers.Control, {
/** @type DOMElement */
/**
* Parameter: element
* {DOMElement}
*/
element: null, element: null,
/** /**
* @constructor * Constructor: OpenLayers.Control.Scale
* *
* @param {DOMElement} element * Parameters:
* @param {String} base * element - {DOMElement}
* base - {String}
*/ */
initialize: function(element) { initialize: function(element) {
OpenLayers.Control.prototype.initialize.apply(this, arguments); OpenLayers.Control.prototype.initialize.apply(this, arguments);
@@ -26,7 +34,9 @@ OpenLayers.Control.Scale.prototype =
}, },
/** /**
* @type DOMElement * Method: draw
*
* Returns: {DOMElemen}t
*/ */
draw: function() { draw: function() {
OpenLayers.Control.prototype.draw.apply(this, arguments); OpenLayers.Control.prototype.draw.apply(this, arguments);
@@ -42,7 +52,7 @@ OpenLayers.Control.Scale.prototype =
}, },
/** /**
* * Method: updateScale
*/ */
updateScale: function() { updateScale: function() {
var scale = this.map.getScale(); var scale = this.map.getScale();
+55 -24
View File
@@ -4,64 +4,77 @@
/** /**
* Draws features on a vector layer when active.
*
* @class
* @requires OpenLayers/Control.js * @requires OpenLayers/Control.js
* @requires OpenLayers/Feature/Vector.js * @requires OpenLayers/Feature/Vector.js
*
* Class: OpenLayers.Control.SelectFeature
* Draws features on a vector layer when active.
*
* Inherits from:
* - <OpenLayers.Control>
*/ */
OpenLayers.Control.SelectFeature = OpenLayers.Class.create(); OpenLayers.Control.SelectFeature = OpenLayers.Class.create();
OpenLayers.Control.SelectFeature.prototype = OpenLayers.Control.SelectFeature.prototype =
OpenLayers.Class.inherit(OpenLayers.Control, { OpenLayers.Class.inherit(OpenLayers.Control, {
/** /**
* @type {Boolean} Allow selection of multiple geometries * APIProperty: multiple
* {Boolean} Allow selection of multiple geometries
*/ */
multiple: false, multiple: false,
/** /**
* @type {Boolean} Select on mouse over and deselect on mouse out. If * APIProperty: hover
* true, this ignores clicks and only listens to mouse moves. * {Boolean} Select on mouse over and deselect on mouse out. If true, this
* ignores clicks and only listens to mouse moves.
*/ */
hover: false, hover: false,
/** /**
* @type {Function} Optional function to be called when a feature is selected. * APIProperty: onSelect
* The function should expect to be called with a feature. * {Function} Optional function to be called when a feature is selected.
* The function should expect to be called with a feature.
*/ */
onSelect: function() {}, onSelect: function() {},
/** /**
* @type {Function} Optional function to be called when a feature is unselected. * APIProperty: onUnselect
* {Function} Optional function to be called when a feature is unselected.
* The function should expect to be called with a feature. * The function should expect to be called with a feature.
*/ */
onUnselect: function() {}, onUnselect: function() {},
/** /**
* @type {OpenLayers.Layer.Vector} * Property: layer
* {<OpenLayers.Layer.Vector>}
*/ */
layer: null, layer: null,
/** /**
* @type {Object} The functions that are sent to the handler for callback * APIProperty: callbacks
* {Object} The functions that are sent to the handler for callback
*/ */
callbacks: null, callbacks: null,
/** /**
* @type {Object} Hash of styles * APIProperty: selectStyle
* {Object} Hash of styles
*/ */
selectStyle: OpenLayers.Feature.Vector.style['select'], selectStyle: OpenLayers.Feature.Vector.style['select'],
/** /**
* @type {OpenLayers.Handler.Feature} * Property: handler
* @private * {<OpenLayers.Handler.Feature>}
*/ */
handler: null, handler: null,
/** /**
* @param {OpenLayers.Layer.Vector} layer * Constructor: <OpenLayers.Control.SelectFeature>
* @param {OpenLayers.Handler} handler *
* @param {Object} options * Parameters:
* layer - {<OpenLayers.Layer.Vector>}
* handler - {<OpenLayers.Handler>}
* options - {Object}
*/ */
initialize: function(layer, options) { initialize: function(layer, options) {
OpenLayers.Control.prototype.initialize.apply(this, [options]); OpenLayers.Control.prototype.initialize.apply(this, [options]);
@@ -75,8 +88,11 @@ OpenLayers.Control.SelectFeature.prototype =
}, },
/** /**
* Method: downFeature
* Called when the feature handler detects a mouse-down on a feature * Called when the feature handler detects a mouse-down on a feature
* @param {OpenLayers.Vector.Feature} *
* Parameters:
* feature - {<OpenLayers.Vector.Feature>}
*/ */
downFeature: function(feature) { downFeature: function(feature) {
if(this.hover) { if(this.hover) {
@@ -103,9 +119,12 @@ OpenLayers.Control.SelectFeature.prototype =
}, },
/** /**
* Method: overFeature
* Called when the feature handler detects a mouse-over on a feature. * Called when the feature handler detects a mouse-over on a feature.
* Only responds if this.hover is true. * Only responds if this.hover is true.
* @param {OpenLayers.Feature.Vector} *
* Parameters:
* feature - {<OpenLayers.Feature.Vector>}
*/ */
overFeature: function(feature) { overFeature: function(feature) {
if(!this.hover) { if(!this.hover) {
@@ -117,9 +136,12 @@ OpenLayers.Control.SelectFeature.prototype =
}, },
/** /**
* Method: outFeature
* Called when the feature handler detects a mouse-out on a feature. * Called when the feature handler detects a mouse-out on a feature.
* Only responds if this.hover is true. * Only responds if this.hover is true.
* @param {OpenLayers.Feature.Vector} *
* Parameters:
* feature - {<OpenLayers.Feature.Vector>}
*/ */
outFeature: function(feature) { outFeature: function(feature) {
if(!this.hover) { if(!this.hover) {
@@ -129,9 +151,12 @@ OpenLayers.Control.SelectFeature.prototype =
}, },
/** /**
* Method: select
* Add feature to the layer's selectedFeature array, render the feature as * Add feature to the layer's selectedFeature array, render the feature as
* selected, and call the onSelect function. * selected, and call the onSelect function.
* @param {OpenLayers.Feature.Vector} feature *
* Parameters:
* feature - {<OpenLayers.Feature.Vector>}
*/ */
select: function(feature) { select: function(feature) {
// Store feature style for restoration later // Store feature style for restoration later
@@ -144,9 +169,12 @@ OpenLayers.Control.SelectFeature.prototype =
}, },
/** /**
* Method: unselect
* Remove feature from the layer's selectedFeature array, render the feature as * Remove feature from the layer's selectedFeature array, render the feature as
* normal, and call the onUnselect function. * normal, and call the onUnselect function.
* @param {OpenLayers.Feature.Vector} feature *
* Parameters:
* feature - {<OpenLayers.Feature.Vector>}
*/ */
unselect: function(feature) { unselect: function(feature) {
// Store feature style for restoration later // Store feature style for restoration later
@@ -158,9 +186,12 @@ OpenLayers.Control.SelectFeature.prototype =
this.onUnselect(feature); this.onUnselect(feature);
}, },
/** Set the map property for the control. /**
* Method: setMap
* Set the map property for the control.
* *
* @param {OpenLayers.Map} map * Parameters:
* map - {<OpenLayers.Map>}
*/ */
setMap: function(map) { setMap: function(map) {
this.handler.setMap(map); this.handler.setMap(map);
+16 -4
View File
@@ -3,25 +3,37 @@
* for the full text of the license. */ * for the full text of the license. */
/** /**
* @class
*
* @requires OpenLayers/Control.js * @requires OpenLayers/Control.js
* @requires OpenLayers/Handler/Box.js * @requires OpenLayers/Handler/Box.js
*
* Class: OpenLayers.Control.ZoomBox
*
* Inherits from:
* - <OpenLayers.Control>
*/ */
OpenLayers.Control.ZoomBox = OpenLayers.Class.create(); OpenLayers.Control.ZoomBox = OpenLayers.Class.create();
OpenLayers.Control.ZoomBox.prototype = OpenLayers.Control.ZoomBox.prototype =
OpenLayers.Class.inherit( OpenLayers.Control, { OpenLayers.Class.inherit( OpenLayers.Control, {
/** @type OpenLayers.Control.TYPE_* */ /**
* Property: type
* {OpenLayers.Control.TYPE}
*/
type: OpenLayers.Control.TYPE_TOOL, type: OpenLayers.Control.TYPE_TOOL,
/** /**
* * Method: draw
*/ */
draw: function() { draw: function() {
this.handler = new OpenLayers.Handler.Box( this, this.handler = new OpenLayers.Handler.Box( this,
{done: this.zoomBox}, {keyMask: this.keyMask} ); {done: this.zoomBox}, {keyMask: this.keyMask} );
}, },
/**
* Method: zoomBox
*
* Parameters:
* position - {<OpenLayers.Bounds>} or {<OpenLayers.Pixel>}
*/
zoomBox: function (position) { zoomBox: function (position) {
if (position instanceof OpenLayers.Bounds) { if (position instanceof OpenLayers.Bounds) {
var minXY = this.map.getLonLatFromPixel( var minXY = this.map.getLonLatFromPixel(
+15 -4
View File
@@ -3,17 +3,28 @@
* for the full text of the license. */ * for the full text of the license. */
/** /**
* @class
*
* Imlements a very simple button control.
* @requires OpenLayers/Control.js * @requires OpenLayers/Control.js
*
* Class: OpenLayers.Control.ZoomToMaxExtent
* Imlements a very simple button control. Designed to be used with a
* <OpenLayers.Control.Panel>.
*
* Inherits from:
* - <OpenLayers.Control>
*/ */
OpenLayers.Control.ZoomToMaxExtent = OpenLayers.Class.create(); OpenLayers.Control.ZoomToMaxExtent = OpenLayers.Class.create();
OpenLayers.Control.ZoomToMaxExtent.prototype = OpenLayers.Control.ZoomToMaxExtent.prototype =
OpenLayers.Class.inherit( OpenLayers.Control, { OpenLayers.Class.inherit( OpenLayers.Control, {
/** @type OpenLayers.Control.TYPE_* */ /**
* Property: type
* TYPE_BUTTON.
*/
type: OpenLayers.Control.TYPE_BUTTON, type: OpenLayers.Control.TYPE_BUTTON,
/*
* Method: trigger
* Do the zoom.
*/
trigger: function() { trigger: function() {
if (this.map) { if (this.map) {
this.map.zoomToMaxExtent(); this.map.zoomToMaxExtent();
+226 -127
View File
@@ -2,74 +2,115 @@
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt * See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
* for the full text of the license. */ * for the full text of the license. */
/** /**
* @requires OpenLayers/Util.js * @requires OpenLayers/Util.js
* *
* @class (Not really a class, but kind of) * Title: OpenLayers.Events
* *
* Class: OpenLayers.Event
* Utility functions for event handling.
*/ */
OpenLayers.Event = { OpenLayers.Event = {
/** A hashtable cache of the event observers. /**
* Keyed by element._eventCacheID * Property: observers
* * {Object} A hashtable cache of the event observers. Keyed by
* @type Object * element._eventCacheID
*/ */
observers: false, observers: false,
/** @final @type int */ /**
KEY_BACKSPACE: 8, * Constant: KEY_BACKSPACE
* {int}
*/
KEY_BACKSPACE: 8,
/** @final @type int */ /**
KEY_TAB: 9, * Constant: KEY_TAB
* {int}
*/
KEY_TAB: 9,
/** @final @type int */ /**
KEY_RETURN: 13, * Constant: KEY_RETURN
* {int}
*/
KEY_RETURN: 13,
/** @final @type int */ /**
KEY_ESC: 27, * Constant: KEY_ESC
* {int}
*/
KEY_ESC: 27,
/** @final @type int */ /**
KEY_LEFT: 37, * Constant: KEY_LEFT
* {int}
*/
KEY_LEFT: 37,
/** @final @type int */ /**
KEY_UP: 38, * Constant: KEY_UP
* {int}
*/
KEY_UP: 38,
/** @final @type int */ /**
KEY_RIGHT: 39, * Constant: KEY_RIGHT
* {int}
*/
KEY_RIGHT: 39,
/** @final @type int */ /**
KEY_DOWN: 40, * Constant: KEY_DOWN
* {int}
*/
KEY_DOWN: 40,
/** @final @type int */ /**
KEY_DELETE: 46, * Constant: KEY_DELETE
* {int}
*/
KEY_DELETE: 46,
/** /**
* @param {Event} event * Method: element
* Cross browser event element detection.
* *
* @returns The element that caused the alert * Parameters:
* @type DOMElement * event - {Event}
*
* Returns:
* {DOMElement} The element that caused the event
*/ */
element: function(event) { element: function(event) {
return event.target || event.srcElement; return event.target || event.srcElement;
}, },
/** /**
* @param {Event} event * Method: isLeftClick
* Determine whether event was caused by a left click.
*
* Parameters:
* event - {Event}
* *
* @returns Whether or not the event was the result of a left click * Returns:
* @type boolean * {Boolean}
*/ */
isLeftClick: function(event) { isLeftClick: function(event) {
return (((event.which) && (event.which == 1)) || return (((event.which) && (event.which == 1)) ||
((event.button) && (event.button == 1))); ((event.button) && (event.button == 1)));
}, },
/** Stops an event from propagating. /**
* * Method: stop
* @param {Event} event * Stops an event from propagating.
* @param {Boolean} allowDefault If true, we stop the event chain but *
* Parameters:
* event - {Event}
* allowDefault - {Boolean} If true, we stop the event chain but
* still allow the default browser * still allow the default browser
* behaviour (text selection, radio-button * behaviour (text selection, radio-button
* clicking, etc) * clicking, etc)
@@ -93,12 +134,15 @@ OpenLayers.Event = {
}, },
/** /**
* @param {Event} event * Method: findElement
* @param {String} tagName
* *
* @returns The first node with the given tagName, starting from the node * Parameters:
* the event was triggered on and traversing the DOM upwards * event - {Event}
* @type DOMElement * tagName - {String}
*
* Return:
* {DOMElement} The first node with the given tagName, starting from the
* node the event was triggered on and traversing the DOM upwards
*/ */
findElement: function(event, tagName) { findElement: function(event, tagName) {
var element = OpenLayers.Event.element(event); var element = OpenLayers.Event.element(event);
@@ -109,11 +153,13 @@ OpenLayers.Event = {
}, },
/** /**
* @param {DOMElement || String} elementParam * Method: observe
* @param {String} name
* @param {function} observer
* @param {Boolean} useCapture
* *
* Parameters:
* elementParam - {DOMElement || String}
* name - {String}
* observer - {function}
* useCapture - {Boolean}
*/ */
observe: function(elementParam, name, observer, useCapture) { observe: function(elementParam, name, observer, useCapture) {
var element = OpenLayers.Util.getElement(elementParam); var element = OpenLayers.Util.getElement(elementParam);
@@ -162,11 +208,14 @@ OpenLayers.Event = {
} }
}, },
/** Given the id of an element to stop observing, cycle through the /**
* Method: stopObservingElement
* Given the id of an element to stop observing, cycle through the
* element's cached observers, calling stopObserving on each one, * element's cached observers, calling stopObserving on each one,
* skipping those entries which can no longer be removed. * skipping those entries which can no longer be removed.
* *
* @param {DOMElement || String} elementParam * parameters:
* elementParam - {DOMElement || String}
*/ */
stopObservingElement: function(elementParam) { stopObservingElement: function(elementParam) {
var element = OpenLayers.Util.getElement(elementParam); var element = OpenLayers.Util.getElement(elementParam);
@@ -176,9 +225,11 @@ OpenLayers.Event = {
}, },
/** /**
* @private * Method: _removeElementObservers
* * *Private*.
* @param {Array(Object)} elementObservers Array of (element, name, *
* Parameters:
* elementObservers - {Array(Object)} Array of (element, name,
* observer, usecapture) objects, * observer, usecapture) objects,
* taken directly from hashtable * taken directly from hashtable
*/ */
@@ -196,13 +247,16 @@ OpenLayers.Event = {
}, },
/** /**
* @param {DOMElement || String} elementParam * Method: stopObserving
* @param {String} name
* @param {function} observer
* @param {Boolean} useCapture
* *
* @returns Whether or not the event observer was removed * Parameters:
* @type Boolean * elementParam - {DOMElement || String}
* name - {String}
* observer - {function}
* useCapture - {Boolean}
*
* Return:
* {Boolean} Whether or not the event observer was removed
*/ */
stopObserving: function(elementParam, name, observer, useCapture) { stopObserving: function(elementParam, name, observer, useCapture) {
useCapture = useCapture || false; useCapture = useCapture || false;
@@ -251,7 +305,9 @@ OpenLayers.Event = {
return foundEntry; return foundEntry;
}, },
/** Cycle through all the element entries in the events cache and call /**
* Method: unloadCache
* Cycle through all the element entries in the events cache and call
* stopObservingElement on each. * stopObservingElement on each.
*/ */
unloadCache: function() { unloadCache: function() {
@@ -279,12 +335,15 @@ if (window.Event) {
} }
/** /**
* @class * Class: OpenLayers.Events
*/ */
OpenLayers.Events = OpenLayers.Class.create(); OpenLayers.Events = OpenLayers.Class.create();
OpenLayers.Events.prototype = { OpenLayers.Events.prototype = {
/** @final @type Array: supported events */ /**
* Constant: BROWSER_EVENTS
* {Array} supported events
*/
BROWSER_EVENTS: [ BROWSER_EVENTS: [
"mouseover", "mouseout", "mouseover", "mouseout",
"mousedown", "mouseup", "mousemove", "mousedown", "mouseup", "mousemove",
@@ -292,37 +351,52 @@ OpenLayers.Events.prototype = {
"resize", "focus", "blur" "resize", "focus", "blur"
], ],
/** Hashtable of Array(Function): events listener functions /**
* @type Object */ * Property: listeners
listeners: null, * {Object} Hashtable of Array(Function): events listener functions
*/
listeners: null,
/** @type Object: the code object issuing application events */ /**
object: null, * Property: object
* {Object} the code object issuing application events
*/
object: null,
/** @type DOMElement: the DOM element receiving browser events */ /**
element: null, * Property: element
* {DOMElement} the DOM element receiving browser events
*/
element: null,
/** @type Array: list of support application events */ /**
eventTypes: null, * Property: eventTypes
* {Array} list of support application events
*/
eventTypes: null,
/**
* Property: eventHandler
* {Function} bound event handler attached to elements
*/
eventHandler: null,
/**
* Property: fallThrough
* {Boolean}
*/
fallThrough: null,
/** /**
* @type Function: bound event handler attached to elements * Constructor: OpenLayers.Events
* @private * Construct an OpenLayers.Events object.
*/ *
eventHandler: null, * Parameters:
* object - {Object} The js object to which this Events object is being
/** @type Boolean */ * added element - {DOMElement} A dom element to respond to browser events
fallThrough: null, * eventTypes - {Array} Array of custom application events
* fallThrough - {Boolean} Allow events to fall through after these have
/** * been handled?
* @constructor
*
* @param {OpenLayers.Map} object The js object to which this Events object
* is being added
* @param {DOMElement} element A dom element to respond to browser events
* @param {Array} eventTypes Array of custom application events
* @param {Boolean} fallThrough Allow events to fall through after these
* have been handled?
*/ */
initialize: function (object, element, eventTypes, fallThrough) { initialize: function (object, element, eventTypes, fallThrough) {
this.object = object; this.object = object;
@@ -351,7 +425,7 @@ OpenLayers.Events.prototype = {
}, },
/** /**
* * Method: destroy
*/ */
destroy: function () { destroy: function () {
if (this.element) { if (this.element) {
@@ -367,7 +441,10 @@ OpenLayers.Events.prototype = {
}, },
/** /**
* @param {HTMLDOMElement} element a DOM element to attach browser events to * Method: attachToElement
*
* Parameters:
* element - {HTMLDOMElement} a DOM element to attach browser events to
*/ */
attachToElement: function (element) { attachToElement: function (element) {
for (var i = 0; i < this.BROWSER_EVENTS.length; i++) { for (var i = 0; i < this.BROWSER_EVENTS.length; i++) {
@@ -387,26 +464,30 @@ OpenLayers.Events.prototype = {
}, },
/** /**
* @param {String} type Name of the event to register * Method: register
* @param {Object} obj The object to bind the context to for the callback#. * Register an event on the events object.
* If no object is specified, default is the Events's *
* 'object' property. * When the event is triggered, the 'func' function will be called, in the
* @param {Function} func The callback function. If no callback is * context of 'obj'. Imagine we were to register an event, specifying an
* specified, this function does nothing. * OpenLayers.Bounds Object as 'obj'. When the event is triggered, the
* * context in the callback function will be our Bounds object. This means
* #When the event is triggered, the 'func' function will be called, in the * that within our callback function, we can access the properties and
* context of 'obj'. Imagine we were to register an event, specifying an * methods of the Bounds object through the "this" variable. So our
* OpenLayers.Bounds Object as 'obj'. When the event is triggered, the * callback could execute something like:
* context in the callback function will be our Bounds object. This means * : leftStr = "Left: " + this.left;
* that within our callback function, we can access the properties and
* methods of the Bounds object through the "this" variable. So our
* callback could execute something like:
*
* leftStr = "Left: " + this.left;
* *
* or * or
* *
* centerStr = "Center: " + this.getCenterLonLat(); * : centerStr = "Center: " + this.getCenterLonLat();
*
* Parameters:
* type - {String} Name of the event to register
* obj - {Object} The object to bind the context to for the callback#.
* If no object is specified, default is the Events's
* 'object' property.
* func - {Function} The callback function. If no callback is
* specified, this function does nothing.
*
* *
*/ */
register: function (type, obj, func) { register: function (type, obj, func) {
@@ -425,12 +506,15 @@ OpenLayers.Events.prototype = {
/** /**
* TODO: get rid of this in 3.0 - Decide whether listeners should be * TODO: get rid of this in 3.0 - Decide whether listeners should be
* called in the order they were registered or in reverse order. * called in the order they were registered or in reverse order.
* *
* @param {String} type Name of the event to register * Method: registerPriority
* @param {Object} obj The object to bind the context to for the callback#. *
* Parameters:
* type - {String} Name of the event to register
* obj - {Object} The object to bind the context to for the callback#.
* If no object is specified, default is the Events's * If no object is specified, default is the Events's
* 'object' property. * 'object' property.
* @param {Function} func The callback function. If no callback is * func - {Function} The callback function. If no callback is
* specified, this function does nothing. * specified, this function does nothing.
*/ */
registerPriority: function (type, obj, func) { registerPriority: function (type, obj, func) {
@@ -447,9 +531,12 @@ OpenLayers.Events.prototype = {
}, },
/** /**
* @param {String} type * Method: unregister
* @param {Object} obj If none specified, defaults to this.object *
* @param {Function} func * Parameters:
* type - {String}
* obj - {Object} If none specified, defaults to this.object
* func - {Function}
*/ */
unregister: function (type, obj, func) { unregister: function (type, obj, func) {
if (obj == null) { if (obj == null) {
@@ -466,10 +553,13 @@ OpenLayers.Events.prototype = {
} }
}, },
/** Remove all listeners for a given event type. If type is not registered, /**
* Method: remove
* Remove all listeners for a given event type. If type is not registered,
* does nothing. * does nothing.
* *
* @param {String} type * Parameters:
* type - {String}
*/ */
remove: function(type) { remove: function(type) {
if (this.listeners[type] != null) { if (this.listeners[type] != null) {
@@ -477,10 +567,13 @@ OpenLayers.Events.prototype = {
} }
}, },
/** Trigger a specified registered event /**
* Method: triggerEvent
* Trigger a specified registered event
* *
* @param {String} type * Parameters:
* @param {Event} evt * type - {String}
* evt - {Event}
*/ */
triggerEvent: function (type, evt) { triggerEvent: function (type, evt) {
@@ -519,13 +612,16 @@ OpenLayers.Events.prototype = {
} }
}, },
/** Basically just a wrapper to the triggerEvent() function, but takes /**
* Method: handleBrowserEvent
* Basically just a wrapper to the triggerEvent() function, but takes
* care to set a property 'xy' on the event with the current mouse * care to set a property 'xy' on the event with the current mouse
* position. * position.
* *
* @private * Private function.
* *
* @param {Event} evt * Parameters:
* evt - {Event}
*/ */
handleBrowserEvent: function (evt) { handleBrowserEvent: function (evt) {
evt.xy = this.getMousePosition(evt); evt.xy = this.getMousePosition(evt);
@@ -533,12 +629,15 @@ OpenLayers.Events.prototype = {
}, },
/** /**
* @private * Method: getMousePosition
* *Private*
* *
* @param {Event} evt * Parameters:
* evt - {Event}
* *
* @returns The current xy coordinate of the mouse, adjusted for offsets * Returns
* @type OpenLayers.Pixel * {<OpenLayers.Pixel>} The current xy coordinate of the mouse, adjusted
* for offsets
*/ */
getMousePosition: function (evt) { getMousePosition: function (evt) {
if (!this.element.offsets) { if (!this.element.offsets) {
+90 -44
View File
@@ -4,41 +4,69 @@
/** /**
* @class
*
* @requires OpenLayers/Util.js * @requires OpenLayers/Util.js
* @requires OpenLayers/Marker.js * @requires OpenLayers/Marker.js
*
* Class: OpenLayers.Feature
* Features are combinations of geography and attributes. The OpenLayers.Feature
* class specifically combines a marker and a lonlat.
*/ */
OpenLayers.Feature = OpenLayers.Class.create(); OpenLayers.Feature = OpenLayers.Class.create();
OpenLayers.Feature.prototype= { OpenLayers.Feature.prototype= {
/** @type OpenLayers.Events */ /**
events:null, * Property: events
* {<OpenLayers.Events>}
/** @type OpenLayers.Layer */ */
layer: null, events: null,
/** @type String */
id: null,
/** @type OpenLayers.LonLat */
lonlat:null,
/** @type Object */
data:null,
/** @type OpenLayers.Marker */
marker: null,
/** @type OpenLayers.Popup */
popup: null,
/** /**
* @constructor * Property: layer
* {<OpenLayers.Layer>}
*/
layer: null,
/**
* Property: id
* {String}
*/
id: null,
/**
* Property: lonlat
* {<OpenLayers.LonLat>}
*/
lonlat: null,
/**
* Property: data
* {Object}
*/
data: null,
/**
* Property: marker
* {<OpenLayers.Marker>}
*/
marker: null,
/**
* Property: popup
* {<OpenLayers.Popup>}
*/
popup: null,
/**
* Constructor: OpenLayers.Feature
* Constructor for features.
*
* Parameters:
* layer - {<OpenLayers.Layer>}
* lonlat - {<OpenLayers.LonLat>}
* data - {Object}
* *
* @param {OpenLayers.Layer} layer * Return:
* @param {OpenLayers.LonLat} lonlat * {<OpenLayers.Feature>}
* @param {Object} data
*/ */
initialize: function(layer, lonlat, data) { initialize: function(layer, lonlat, data) {
this.layer = layer; this.layer = layer;
@@ -47,8 +75,9 @@ OpenLayers.Feature.prototype= {
this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_"); this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_");
}, },
/** /**
* * Method: destroy
* nullify references to prevent circular references and memory leaks
*/ */
destroy: function() { destroy: function() {
@@ -79,9 +108,11 @@ OpenLayers.Feature.prototype= {
}, },
/** /**
* @returns Whether or not the feature is currently visible on screen * Method: onScreen
*
* Returns:
* {Boolean} Whether or not the feature is currently visible on screen
* (based on its 'lonlat' property) * (based on its 'lonlat' property)
* @type Boolean
*/ */
onScreen:function() { onScreen:function() {
@@ -95,13 +126,16 @@ OpenLayers.Feature.prototype= {
/** /**
* @returns A Marker Object created from the 'lonlat' and 'icon' properties * Method: createMarker
* Based on the data associated with the Feature, create and return a marker object.
*
* Return:
* {<OpenLayers.Marker>} A Marker Object created from the 'lonlat' and 'icon' properties
* set in this.data. If no 'lonlat' is set, returns null. If no * set in this.data. If no 'lonlat' is set, returns null. If no
* 'icon' is set, OpenLayers.Marker() will load the default image. * 'icon' is set, OpenLayers.Marker() will load the default image.
* *
* Note: this.marker is set to return value * Note - this.marker is set to return value
* *
* @type OpenLayers.Marker
*/ */
createMarker: function() { createMarker: function() {
@@ -113,7 +147,10 @@ OpenLayers.Feature.prototype= {
return this.marker; return this.marker;
}, },
/** If user overrides the createMarker() function, s/he should be able /**
* Method: destroyMarker
* Destroys marker.
* If user overrides the createMarker() function, s/he should be able
* to also specify an alternative function for destroying it * to also specify an alternative function for destroying it
*/ */
destroyMarker: function() { destroyMarker: function() {
@@ -121,17 +158,22 @@ OpenLayers.Feature.prototype= {
}, },
/** /**
* @param {Boolean} closeBox create popup with closebox or not * Method: createPopup
* @returns A Popup Object created from the 'lonlat', 'popupSize', * Creates a popup object created from the 'lonlat', 'popupSize',
* and 'popupContentHTML' properties set in this.data. It uses * and 'popupContentHTML' properties set in this.data. It uses
* this.marker.icon as default anchor. * this.marker.icon as default anchor.
* *
* If no 'lonlat' is set, returns null. * If no 'lonlat' is set, returns null.
* If no this.marker has been created, no anchor is sent. * If no this.marker has been created, no anchor is sent.
* *
* Note: this.popup is set to return value * Note - this.popup is set to return value
*
* Parameters:
* closeBox - {Boolean} create popup with closebox or not
*
* Returns:
* {<OpenLayers.Popup.AnchoredBubble>}
* *
* @type OpenLayers.Popup.AnchoredBubble
*/ */
createPopup: function(closeBox) { createPopup: function(closeBox) {
@@ -150,7 +192,11 @@ OpenLayers.Feature.prototype= {
}, },
/** As with the marker, if user overrides the createPopup() function, s/he /**
* Method: destroyPopup
* Destroys the popup created via createPopup.
*
* As with the marker, if user overrides the createPopup() function, s/he
* should also be able to override the destruction * should also be able to override the destruction
*/ */
destroyPopup: function() { destroyPopup: function() {
+103 -41
View File
@@ -12,36 +12,60 @@ OpenLayers.State = {
} }
/** /**
* @class
*
* @requires OpenLayers/Feature.js * @requires OpenLayers/Feature.js
* @requires OpenLayers/Util.js * @requires OpenLayers/Util.js
*
* Class: OpenLayers.Feature.Vector
* Vector features use the OpenLayers.Geometry classes as geometry description.
* They have an 'attributes' property, which is the data object, and a 'style'
* property, the default values of which are defined in the
* <OpenLayers.Feature.Vector.style> objects.
*
* Inherits from:
* - <OpenLayers.Feature>
*/ */
OpenLayers.Feature.Vector = OpenLayers.Class.create(); OpenLayers.Feature.Vector = OpenLayers.Class.create();
OpenLayers.Feature.Vector.prototype = OpenLayers.Feature.Vector.prototype =
OpenLayers.Class.inherit( OpenLayers.Feature, { OpenLayers.Class.inherit( OpenLayers.Feature, {
/** @type String */ /**
fid: null, * Property: fid
* {String}
/** @type OpenLayers.Geometry */ */
geometry:null, fid: null,
/** @type Object */
attributes: null,
/** @type String */
state: null,
/** @type Object */
style: null,
/** /**
* Property: geometry
* {<OpenLayers.Geometry>}
*/
geometry: null,
/**
* Property: attributes
* {Object}
*/
attributes: null,
/**
* Property: state
* {String}
*/
state: null,
/**
* Property: style
* {Object}
*/
style: null,
/**
* Constructor: OpenLayers.Feature.Vector
* Create a vector feature. * Create a vector feature.
* @constructor
* *
* @param {OpenLayers.Geometry} geometry * Parameters:
* @param {Object} data * geometry - {<OpenLayers.Geometry>}
* data - {Object}
* style - {Object}
*/ */
initialize: function(geometry, data, style) { initialize: function(geometry, data, style) {
OpenLayers.Feature.prototype.initialize.apply(this, [null, null, data]); OpenLayers.Feature.prototype.initialize.apply(this, [null, null, data]);
@@ -55,8 +79,9 @@ OpenLayers.Feature.Vector.prototype =
this.style = style ? style : null; this.style = style ? style : null;
}, },
/** /**
* * Method: destroy
* nullify references to prevent circular references and memory leaks
*/ */
destroy: function() { destroy: function() {
if (this.layer) { if (this.layer) {
@@ -69,8 +94,10 @@ OpenLayers.Feature.Vector.prototype =
}, },
/** /**
* @returns An exact clone of this OpenLayers.Feature * Method: clone
* @type OpenLayers.Feature *
* Returns:
* <OpenLayers.Feature> An exact clone of this OpenLayers.Feature
*/ */
clone: function (obj) { clone: function (obj) {
if (obj == null) { if (obj == null) {
@@ -84,30 +111,32 @@ OpenLayers.Feature.Vector.prototype =
}, },
/** /**
* Method: onScreen
* HACK - we need to rewrite this for non-point geometry * HACK - we need to rewrite this for non-point geometry
* @returns null - we need to rewrite this for non-point geometry *
* @type Boolean * Return:
* {Boolean} For now just returns null
*/ */
onScreen:function() { onScreen:function() {
return null; return null;
}, },
/** /**
* * Method: createMarker
* HACK - we need to decide if all vector features should be able to * HACK - we need to decide if all vector features should be able to
* create markers * create markers
* *
* @returns null * Return:
* * {<OpenLayers.Marker>} For now just returns null
* @type OpenLayers.Marker
*/ */
createMarker: function() { createMarker: function() {
return null; return null;
}, },
/** /**
* Method: destroyMarker
* HACK - we need to decide if all vector features should be able to * HACK - we need to decide if all vector features should be able to
* delete markers * delete markers
* *
* If user overrides the createMarker() function, s/he should be able * If user overrides the createMarker() function, s/he should be able
* to also specify an alternative function for destroying it * to also specify an alternative function for destroying it
@@ -117,22 +146,28 @@ OpenLayers.Feature.Vector.prototype =
}, },
/** /**
* Method: createPopup
* HACK - we need to decide if all vector features should be able to * HACK - we need to decide if all vector features should be able to
* create popups * create popups
* *
* @returns null * Return:
* {<OpenLayers.Popup>} For now just returns null
*/ */
createPopup: function() { createPopup: function() {
return null; return null;
}, },
/** /**
* @param {OpenLayers.LonLat} lonlat * Method: atPoint
* @param {float} toleranceLon Optional tolerance in Geometric Coords * Determins whether the feature intersects with the specified location.
* @param {float} toleranceLat Optional tolerance in Geographic Coords
* *
* @returns Whether or not the feature is at the specified location * Parameters:
* @type Boolean * lonlat - {<OpenLayers.LonLat>}
* toleranceLon - {float} Optional tolerance in Geometric Coords
* toleranceLat - {float} Optional tolerance in Geographic Coords
*
* Returns:
* {Boolean} Whether or not the feature is at the specified location
*/ */
atPoint: function(lonlat, toleranceLon, toleranceLat) { atPoint: function(lonlat, toleranceLon, toleranceLat) {
var atPoint = false; var atPoint = false;
@@ -144,7 +179,7 @@ OpenLayers.Feature.Vector.prototype =
}, },
/** /**
* * Method: destroyPopup
* HACK - we need to decide if all vector features should be able to * HACK - we need to decide if all vector features should be able to
* delete popups * delete popups
*/ */
@@ -153,8 +188,11 @@ OpenLayers.Feature.Vector.prototype =
}, },
/** /**
* Method: toState
* Sets the new state * Sets the new state
* @param {String} state *
* Parameters:
* state - {String}
*/ */
toState: function(state) { toState: function(state) {
if (state == OpenLayers.State.UPDATE) { if (state == OpenLayers.State.UPDATE) {
@@ -196,7 +234,31 @@ OpenLayers.Feature.Vector.prototype =
}); });
// styles for feature rendering /*
* Constant: OpenLayers.Feature.Vector.style
* OpenLayers features can have a number of
* style attributes. The 'default' style will
* typically be used if no other style is specified.
*
* Default style properties:
*
* - fillColor: "#ee9900",
* - fillOpacity: 0.4,
* - hoverFillColor: "white",
* - hoverFillOpacity: 0.8,
* - strokeColor: "#ee9900",
* - strokeOpacity: 1,
* - strokeWidth: 1,
* - strokeLinecap: "round",
* - hoverStrokeColor: "red",
* - hoverStrokeOpacity: 1,
* - hoverStrokeWidth: 0.2,
* - pointRadius: 6,
* - hoverPointRadius: 1,
* - hoverPointUnit: "%",
* - pointerEvents: "visiblePainted"
*/
OpenLayers.Feature.Vector.style = { OpenLayers.Feature.Vector.style = {
'default': { 'default': {
fillColor: "#ee9900", fillColor: "#ee9900",
+28 -9
View File
@@ -4,19 +4,27 @@
/** /**
* @class
*
* @requires OpenLayers/Feature.js * @requires OpenLayers/Feature.js
*
* Class: OpenLayers.Feature.WFS
* WFS handling class, for use as a featureClass on the WFS layer for handling
* 'point' WFS types. Good for subclassing when creating a custom WFS like
* XML application.
*
* Inherits from:
* - <OpenLayers.Feature>
*/ */
OpenLayers.Feature.WFS = OpenLayers.Class.create(); OpenLayers.Feature.WFS = OpenLayers.Class.create();
OpenLayers.Feature.WFS.prototype = OpenLayers.Feature.WFS.prototype =
OpenLayers.Class.inherit( OpenLayers.Feature, { OpenLayers.Class.inherit( OpenLayers.Feature, {
/** /**
* @constructor * Constructor: OpenLayers.Feature.WFS
* * Create a WFS feature.
* @param {OpenLayers.Layer} layer *
* @param {XMLNode} xmlNode * Parameters:
* layer - {<OpenLayers.Layer>}
* xmlNode - {XMLNode}
*/ */
initialize: function(layer, xmlNode) { initialize: function(layer, xmlNode) {
var newArguments = arguments; var newArguments = arguments;
@@ -27,6 +35,10 @@ OpenLayers.Feature.WFS.prototype =
this.layer.addMarker(this.marker); this.layer.addMarker(this.marker);
}, },
/**
* Method: destroy
* nullify references to prevent circular references and memory leaks
*/
destroy: function() { destroy: function() {
if (this.marker != null) { if (this.marker != null) {
this.layer.removeMarker(this.marker); this.layer.removeMarker(this.marker);
@@ -35,10 +47,17 @@ OpenLayers.Feature.WFS.prototype =
}, },
/** /**
* @param {XMLNode} xmlNode * Method: processXMLNode
* When passed an xmlNode, parses it for a GML point, and passes
* back an object describing that point.
*
* For subclasses of Feature.WFS, this is the feature to change.
*
* Parameters:
* xmlNode - {XMLNode}
* *
* @returns Data Object with 'id', 'lonlat', and private properties set * Return:
* @type Object * {Object} Data Object with 'id', 'lonlat', and private properties set
*/ */
processXMLNode: function(xmlNode) { processXMLNode: function(xmlNode) {
//this should be overridden by subclasses //this should be overridden by subclasses
+41 -13
View File
@@ -3,35 +3,63 @@
* for the full text of the license. */ * for the full text of the license. */
/** /**
* Base class for format reading/writing.
* @requires OpenLayers/Util.js * @requires OpenLayers/Util.js
*
* Class: OpenLayers.Format
* Base class for format reading/writing a variety of formats. Subclasses
* of OpenLayers.Format are expected to have read and write methods.
*/ */
OpenLayers.Format = OpenLayers.Class.create(); OpenLayers.Format = OpenLayers.Class.create();
OpenLayers.Format.prototype = { OpenLayers.Format.prototype = {
/**
* Constructor: OpenLayers.Format
* Instances of this class are not useful. See one of the subclasses.
*
* Parameters:
* options - {Object} An optional object with properties to set on the
* format
*
* Return:
* An instance of OpenLayers.Format
*/
initialize: function(options) { initialize: function(options) {
OpenLayers.Util.extend(this, options); OpenLayers.Util.extend(this, options);
}, },
/** /**
* Read data from a string, and return a list of features. * Method: read
* Read data from a string, and return an object whose type depends on the
* subclass.
* *
* @param {string} data data to read/parse. * Parameters:
* data - {string} Data to read/parse.
*
* Return:
* Depends on the subclass
*/ */
read: function(data) { read: function(data) {
alert("Read not implemented."); alert("Read not implemented.");
}, },
/** /**
* Accept Feature Collection, and return a string. * Method: write
* * Accept an object, and return a string.
* @param {Array} List of features to serialize into a string. *
* Parameters:
* object - {Object} Object to be serialized
*
* Return:
* {String} A string representation of the object.
*/ */
write: function(features) { write: function(object) {
alert("Write not implemented."); alert("Write not implemented.");
}, },
/** @final @type String */ /**
* Constant: CLASS_NAME
* {String} OpenLayers.Format
*/
CLASS_NAME: "OpenLayers.Format" CLASS_NAME: "OpenLayers.Format"
}; };
+85 -28
View File
@@ -3,41 +3,74 @@
* for the full text of the license. */ * for the full text of the license. */
/** /**
* Read/WRite GML.
* @requires OpenLayers/Format.js * @requires OpenLayers/Format.js
* @requires OpenLayers/Feature/Vector.js * @requires OpenLayers/Feature/Vector.js
* @requires OpenLayers/Ajax.js * @requires OpenLayers/Ajax.js
* @requires OpenLayers/Geometry.js * @requires OpenLayers/Geometry.js
*
* Class: OpenLayers.Format.GML
* Read/Wite GML.
*
* Inherits from:
* - <OpenLayers.Format>
*/ */
OpenLayers.Format.GML = OpenLayers.Class.create(); OpenLayers.Format.GML = OpenLayers.Class.create();
OpenLayers.Format.GML.prototype = OpenLayers.Format.GML.prototype =
OpenLayers.Class.inherit( OpenLayers.Format, { OpenLayers.Class.inherit( OpenLayers.Format, {
/*
* APIProperty: featureNS
* Namespace used for feature attributes. Default matches the NS
* used by MapServer output.
*/
featureNS: "http://mapserver.gis.umn.edu/mapserver", featureNS: "http://mapserver.gis.umn.edu/mapserver",
/*
* APIProperty: featureName
* element name for features. Default is 'featureMember'.
*/
featureName: "featureMember", featureName: "featureMember",
/*
* APIProperty: layerName
* Name of data layer. Default is 'features'.
*/
layerName: "features", layerName: "features",
/**
* APIProperty: geometry
* Name of geometry element.
*/
geometryName: "geometry", geometryName: "geometry",
/**
* APIProperty: collectionName
* Name of featureCollection element
*/
collectionName: "FeatureCollection", collectionName: "FeatureCollection",
/**
* APIProperty: gmlns
* GML Namespace
*/
gmlns: "http://www.opengis.net/gml", gmlns: "http://www.opengis.net/gml",
/** /**
* Extract attributes from GML. Most of the time, * APIProperty: extractAttributes
* this is a significant time usage, due to the need * {Boolean} Extract attributes from GML. Most of the time, this is a
* to recursively descend the XML to search for attributes. * significant time usage, due to the need to recursively descend the XML
* * to search for attributes.
* @type Boolean */ */
extractAttributes: true, extractAttributes: true,
/** /**
* APIMethod: read
* Read data from a string, and return a list of features. * Read data from a string, and return a list of features.
* *
* @param {string|XMLNode} data data to read/parse. * Parameters:
* data - {String} or {XMLNode} data to read/parse.
*/ */
read: function(data) { read: function(data) {
if (typeof data == "string") { if (typeof data == "string") {
@@ -73,10 +106,13 @@ OpenLayers.Format.GML.prototype =
}, },
/** /**
* Method: parseFeature
* This function is the core of the GML parsing code in OpenLayers. * This function is the core of the GML parsing code in OpenLayers.
* It creates the geometries that are then attached to the returned * It creates the geometries that are then attached to the returned
* feature, and calls parseAttributes() to get attribute data out. * feature, and calls parseAttributes() to get attribute data out.
* @param {DOMElement} xmlNode
* Parameters:
* xmlNode - {<DOMElement>}
*/ */
parseFeature: function(xmlNode) { parseFeature: function(xmlNode) {
var geom; var geom;
@@ -178,10 +214,13 @@ OpenLayers.Format.GML.prototype =
}, },
/** /**
* Method: parseAttributes
* recursive function parse the attributes of a GML node. * recursive function parse the attributes of a GML node.
* Searches for any child nodes which aren't geometries, * Searches for any child nodes which aren't geometries,
* and gets their value. * and gets their value.
* @param {DOMElement} xmlNode *
* Parameters:
* xmlNode - {<DOMElement>}
*/ */
parseAttributes: function(xmlNode) { parseAttributes: function(xmlNode) {
var nodes = xmlNode.childNodes; var nodes = xmlNode.childNodes;
@@ -208,10 +247,13 @@ OpenLayers.Format.GML.prototype =
}, },
/** /**
* Method: parsePolygonNode
*
* Parameters:
* xmlNode - {XMLNode}
* *
* @param {XMLNode} xmlNode * Returns:
* * {<OpenLayers.Geometry.Polygon>} polygon geometry
* @return {OpenLayers.Geometry.Polygon} polygon geometry
*/ */
parsePolygonNode: function(polygonNode) { parsePolygonNode: function(polygonNode) {
var linearRings = OpenLayers.Ajax.getElementsByTagNameNS(polygonNode, var linearRings = OpenLayers.Ajax.getElementsByTagNameNS(polygonNode,
@@ -231,12 +273,14 @@ OpenLayers.Format.GML.prototype =
}, },
/** /**
* Method: parseCoords
* Extract Geographic coordinates from an XML node. * Extract Geographic coordinates from an XML node.
* @private *
* @param {XMLNode} xmlNode * Parameters:
* * xmlNode - {<XMLNode>}
* @return an array of OpenLayers.Geometry.Point points. *
* @type Array * Returns:
* An array of <OpenLayers.Geometry.Point> points.
*/ */
parseCoords: function(xmlNode) { parseCoords: function(xmlNode) {
var x, y, left, bottom, right, top, bounds; var x, y, left, bottom, right, top, bounds;
@@ -287,9 +331,12 @@ OpenLayers.Format.GML.prototype =
}, },
/** /**
* Accept Feature Collection, and return a string. * APIMethod: write
* Accept Feature Array, and return a string.
* *
* @param {Array} List of features to serialize into a string. * Parameters:
* features - Array({<OpenLayers.Feature.Vector>}> List of features to
* serialize into a string.
*/ */
write: function(features) { write: function(features) {
var featureCollection = document.createElementNS("http://www.opengis.net/wfs", "wfs:" + this.collectionName); var featureCollection = document.createElementNS("http://www.opengis.net/wfs", "wfs:" + this.collectionName);
@@ -300,10 +347,14 @@ OpenLayers.Format.GML.prototype =
}, },
/** /**
* Method: createFeatureXML
* Accept an OpenLayers.Feature.Vector, and build a geometry for it. * Accept an OpenLayers.Feature.Vector, and build a geometry for it.
* *
* @param {OpenLayers.Feature.Vector} feature * Parameters:
* @returns {DOMElement} * feature - {<OpenLayers.Feature.Vector>}
*
* Returns:
* {DOMElement}
*/ */
createFeatureXML: function(feature) { createFeatureXML: function(feature) {
var geometryNode = this.buildGeometryNode(feature.geometry); var geometryNode = this.buildGeometryNode(feature.geometry);
@@ -326,10 +377,12 @@ OpenLayers.Format.GML.prototype =
return featureNode; return featureNode;
}, },
/** /**
* Method: buildGeometryNode
* builds a GML file with a given geometry * builds a GML file with a given geometry
* *
* @param {OpenLayers.Geometry} geometry * Parameters:
* geometry - {<OpenLayers.Geometry>}
*/ */
buildGeometryNode: function(geometry) { buildGeometryNode: function(geometry) {
// TBD test if geoserver can be given a Multi-geometry for a simple-geometry data store // TBD test if geoserver can be given a Multi-geometry for a simple-geometry data store
@@ -403,11 +456,15 @@ OpenLayers.Format.GML.prototype =
}, },
/** /**
* Method: buildCoordinates
* builds the coordinates XmlNode * builds the coordinates XmlNode
* <gml:coordinates decimal="." cs="," ts=" ">...</gml:coordinates> * <gml:coordinates decimal="." cs="," ts=" ">...</gml:coordinates>
* *
* @param {OpenLayers.Geometry} geometry * Parameters:
* @return {XmlNode} created xmlNode * geometry - {<OpenLayers.Geometry>}
*
* Returns:
* {XmlNode} created xmlNode
*/ */
buildCoordinatesNode: function(geometry) { buildCoordinatesNode: function(geometry) {
var coordinatesNode = document.createElementNS(this.gmlns, "gml:coordinates"); var coordinatesNode = document.createElementNS(this.gmlns, "gml:coordinates");
+39 -8
View File
@@ -3,23 +3,42 @@
* for the full text of the license. */ * for the full text of the license. */
/** /**
* Write-only GeoRSS.
* @requires OpenLayers/Format.js * @requires OpenLayers/Format.js
*
* Class: OpenLayers.Format.GeoRSS
* Write-only GeoRSS.
*
* Inherits from:
* - <OpenLayers.Format>
*/ */
OpenLayers.Format.GeoRSS = OpenLayers.Class.create(); OpenLayers.Format.GeoRSS = OpenLayers.Class.create();
OpenLayers.Format.GeoRSS.prototype = OpenLayers.Format.GeoRSS.prototype =
OpenLayers.Class.inherit( OpenLayers.Format, { OpenLayers.Class.inherit( OpenLayers.Format, {
/**
* APIProperty: rssns
* RSS namespace to use.
*/
rssns: "http://backend.userland.com/rss2", rssns: "http://backend.userland.com/rss2",
/**
* APIProperty: featurens
* Feature Attributes namespace
*/
featureNS: "http://mapserver.gis.umn.edu/mapserver", featureNS: "http://mapserver.gis.umn.edu/mapserver",
/**
* APIProperty: georssns
* GeoRSS namespace to use.
*/
georssns: "http://www.georss.org/georss", georssns: "http://www.georss.org/georss",
/** /**
* APIMethod: write
* Accept Feature Collection, and return a string. * Accept Feature Collection, and return a string.
* *
* @param {Array} List of features to serialize into a string. * Parameters:
* features - Array({<OpenLayers.Feature.Vector>}) List of features to serialize into a string.
*/ */
write: function(features) { write: function(features) {
var featureCollection = document.createElementNS(this.rssns, "rss"); var featureCollection = document.createElementNS(this.rssns, "rss");
@@ -29,11 +48,15 @@ OpenLayers.Format.GeoRSS.prototype =
return featureCollection; return featureCollection;
}, },
/** /**
* Accept an OpenLayers.Feature.Vector, and build a geometry for it. * Method: createFeatureXML
* Accept an <OpenLayers.Feature.Vector>, and build a geometry for it.
* *
* @param {OpenLayers.Feature.Vector} feature * Parameters:
* @returns DOMElement * feature - {<OpenLayers.Feature.Vector>}
*
* Returns:
* {DOMElement}
*/ */
createFeatureXML: function(feature) { createFeatureXML: function(feature) {
var geometryNode = this.buildGeometryNode(feature.geometry); var geometryNode = this.buildGeometryNode(feature.geometry);
@@ -59,9 +82,11 @@ OpenLayers.Format.GeoRSS.prototype =
}, },
/** /**
* Method: buildGeometryNode
* builds a GeoRSS node with a given geometry * builds a GeoRSS node with a given geometry
* *
* @param {OpenLayers.Geometry} geometry * Parameters:
* geometry - {<OpenLayers.Geometry>}
*/ */
buildGeometryNode: function(geometry) { buildGeometryNode: function(geometry) {
var gml = ""; var gml = "";
@@ -86,7 +111,13 @@ OpenLayers.Format.GeoRSS.prototype =
} }
return gml; return gml;
}, },
/**
* Method: buildCoordinatesNode
*
* Parameters:
* geometry - {<OpenLayers.Geometry>}
*/
buildCoordinatesNode: function(geometry) { buildCoordinatesNode: function(geometry) {
var points = null; var points = null;
+28 -12
View File
@@ -3,25 +3,33 @@
* for the full text of the license. */ * for the full text of the license. */
/** /**
* Read only KML.
* @requires OpenLayers/Format.js * @requires OpenLayers/Format.js
* @requires OpenLayers/Feature/Vector.js * @requires OpenLayers/Feature/Vector.js
* @requires OpenLayers/Ajax.js * @requires OpenLayers/Ajax.js
*
* Class: OpenLayers.Format.KML
* Read only KML. Largely Proof of Concept: does not support advanced Features,
* including Polygons.
*
* Inherits from:
* - <OpenLayers.Format>
*/ */
OpenLayers.Format.KML = OpenLayers.Class.create(); OpenLayers.Format.KML = OpenLayers.Class.create();
OpenLayers.Format.KML.prototype = OpenLayers.Format.KML.prototype =
OpenLayers.Class.inherit( OpenLayers.Format, { OpenLayers.Class.inherit( OpenLayers.Format, {
featureNS: "http://mapserver.gis.umn.edu/mapserver", /**
* APIProperty: kmlns
collectionName: "FeatureCollection", * KML Namespace to use. Defaults to 2.0 namespace.
*/
kmlns: "http://earth.google.com/kml/2.0", kmlns: "http://earth.google.com/kml/2.0",
/** /**
* APIMethod: read
* Read data from a string, and return a list of features. * Read data from a string, and return a list of features.
* *
* @param {string|XMLNode} data data to read/parse. * Parameters:
* data - {string} or {XMLNode>} data to read/parse.
*/ */
read: function(data) { read: function(data) {
if (typeof data == "string") { if (typeof data == "string") {
@@ -43,10 +51,13 @@ OpenLayers.Format.KML.prototype =
}, },
/** /**
* Method: parseFeature
* This function is the core of the KML parsing code in OpenLayers. * This function is the core of the KML parsing code in OpenLayers.
* It creates the geometries that are then attached to the returned * It creates the geometries that are then attached to the returned
* feature, and calls parseAttributes() to get attribute data out. * feature, and calls parseAttributes() to get attribute data out.
* @param {DOMElement} xmlNode *
* Parameters:
* xmlNode - {<DOMElement>}
*/ */
parseFeature: function(xmlNode) { parseFeature: function(xmlNode) {
var geom; var geom;
@@ -87,10 +98,13 @@ OpenLayers.Format.KML.prototype =
}, },
/** /**
* Method: parseAttributes
* recursive function parse the attributes of a KML node. * recursive function parse the attributes of a KML node.
* Searches for any child nodes which aren't geometries, * Searches for any child nodes which aren't geometries,
* and gets their value. * and gets their value.
* @param {DOMElement} xmlNode *
* Parameters:
* xmlNode - {<DOMElement>}
*/ */
parseAttributes: function(xmlNode) { parseAttributes: function(xmlNode) {
var nodes = xmlNode.childNodes; var nodes = xmlNode.childNodes;
@@ -117,12 +131,14 @@ OpenLayers.Format.KML.prototype =
}, },
/** /**
* Method: parseCoords
* Extract Geographic coordinates from an XML node. * Extract Geographic coordinates from an XML node.
* @private *
* @param {XMLNode} xmlNode * Parameters:
* xmlNode - {<XMLNode>}
* *
* @return an array of OpenLayers.Geometry.Point points. * Returns:
* @type Array * An array of <OpenLayers.Geometry.Point> points.
*/ */
parseCoords: function(xmlNode) { parseCoords: function(xmlNode) {
var p = []; var p = [];
+37 -12
View File
@@ -3,25 +3,36 @@
* for the full text of the license. */ * for the full text of the license. */
/** /**
* Read/WRite WFS.
* @requires OpenLayers/Format/GML.js * @requires OpenLayers/Format/GML.js
*
* Class: OpenLayers.Format.WFS
* Read/Write WFS.
*/ */
OpenLayers.Format.WFS = OpenLayers.Class.create(); OpenLayers.Format.WFS = OpenLayers.Class.create();
OpenLayers.Format.WFS.prototype = OpenLayers.Format.WFS.prototype =
OpenLayers.Class.inherit( OpenLayers.Format.GML, { OpenLayers.Class.inherit( OpenLayers.Format.GML, {
/**
* Property: layer
*/
layer: null, layer: null,
/**
* APIProperty: wfsns
*/
wfsns: "http://www.opengis.net/wfs", wfsns: "http://www.opengis.net/wfs",
/* /*
* Constructor: OpenLayers.Format.WFS
* Create a WFS-T formatter. This requires a layer: that layer should * Create a WFS-T formatter. This requires a layer: that layer should
* have two properties: geometry_column and typename. The parser * have two properties: geometry_column and typename. The parser
* for this format is subclassed entirely from GML: There is a writer * for this format is subclassed entirely from GML: There is a writer
* only, which uses most of the code from the GML layer, and wraps * only, which uses most of the code from the GML layer, and wraps
* it in transactional elements. * it in transactional elements.
* @param {Object} options *
* @param {OpenLayers.Layer} layer * Parameters:
* options - {Object}
* layer - {<OpenLayers.Layer>}
*/ */
initialize: function(options, layer) { initialize: function(options, layer) {
@@ -39,10 +50,11 @@ OpenLayers.Format.WFS.prototype =
}, },
/** /**
* write * Method: write
* Takes a feature list, and generates a WFS-T Transaction * Takes a feature list, and generates a WFS-T Transaction
* *
* @param {Array} * Parameters:
* features - {Array}
*/ */
write: function(features) { write: function(features) {
@@ -64,7 +76,13 @@ OpenLayers.Format.WFS.prototype =
} }
return transaction; return transaction;
}, },
/**
* Method: createFeatureXML
*
* Parameters:
* feature - {<OpenLayers.Feature.Vector>}
*/
createFeatureXML: function(feature) { createFeatureXML: function(feature) {
var geometryNode = this.buildGeometryNode(feature.geometry); var geometryNode = this.buildGeometryNode(feature.geometry);
var geomContainer = document.createElementNS(this.featureNS, "feature:" + this.geometryName); var geomContainer = document.createElementNS(this.featureNS, "feature:" + this.geometryName);
@@ -85,10 +103,11 @@ OpenLayers.Format.WFS.prototype =
}, },
/** /**
* insert * Method: insert
* Takes a feature, and generates a WFS-T Transaction "Insert" * Takes a feature, and generates a WFS-T Transaction "Insert"
* *
* @param {OpenLayers.Feature.Vector} feature * Parameters:
* feature - {<OpenLayers.Feature.Vector>}
*/ */
insert: function(feature) { insert: function(feature) {
var insertNode = document.createElementNS(this.wfsns, 'wfs:Insert'); var insertNode = document.createElementNS(this.wfsns, 'wfs:Insert');
@@ -97,10 +116,11 @@ OpenLayers.Format.WFS.prototype =
}, },
/** /**
* update * Method: update
* Takes a feature, and generates a WFS-T Transaction "Update" * Takes a feature, and generates a WFS-T Transaction "Update"
* *
* @param {OpenLayers.Feature.Vector} feature * Parameters:
* feature - {<OpenLayers.Feature.Vector>}
*/ */
update: function(feature) { update: function(feature) {
if (!feature.fid) { alert("Can't update a feature for which there is no FID."); } if (!feature.fid) { alert("Can't update a feature for which there is no FID."); }
@@ -130,10 +150,11 @@ OpenLayers.Format.WFS.prototype =
}, },
/** /**
* delete * Method: remove
* Takes a feature, and generates a WFS-T Transaction "Delete" * Takes a feature, and generates a WFS-T Transaction "Delete"
* *
* @param {OpenLayers.Feature.Vector} feature * Parameters:
* feature - {<OpenLayers.Feature.Vector>}
*/ */
remove: function(feature) { remove: function(feature) {
if (!feature.attributes.fid) { if (!feature.attributes.fid) {
@@ -152,6 +173,10 @@ OpenLayers.Format.WFS.prototype =
return deleteNode; return deleteNode;
}, },
/**
* APIMethod: destroy
* Remove ciruclar ref to layer
*/
destroy: function() { destroy: function() {
this.layer = null; this.layer = null;
}, },
+43 -20
View File
@@ -3,15 +3,29 @@
* for the full text of the license. */ * for the full text of the license. */
/** /**
* Read and write WKT.
* @requires OpenLayers/Format.js * @requires OpenLayers/Format.js
*
* Class: OpenLayers.Format.WKT
* Class for reading and writing Well-Known Text. Create a new instance
* with the <OpenLayers.Format.WKT> constructor.
*
* Inherits from:
* - <OpenLayers.Format>
*/ */
OpenLayers.Format.WKT = OpenLayers.Class.create(); OpenLayers.Format.WKT = OpenLayers.Class.create();
OpenLayers.Format.WKT.prototype = OpenLayers.Format.WKT.prototype =
OpenLayers.Class.inherit(OpenLayers.Format, { OpenLayers.Class.inherit(OpenLayers.Format, {
/** /**
* Constructor: OpenLayers.Format.WKT
* Create a new parser for WKT
* *
* Parameters:
* options - {Object} An optional object whose properties will be set on
* this instance
*
* Return:
* {<OpenLayers.Format.WKT>} A new WKT parser.
*/ */
initialize: function(options) { initialize: function(options) {
this.regExes = { this.regExes = {
@@ -25,14 +39,18 @@ OpenLayers.Format.WKT.prototype =
}, },
/** /**
* Method: read
* Deserialize a WKT string and return an OpenLayers.Feature.Vector or an * Deserialize a WKT string and return an OpenLayers.Feature.Vector or an
* array of OpenLayers.Feature.Vector. Supports WKT for POINT, MULTIPOINT, * array of OpenLayers.Feature.Vector. Supports WKT for POINT, MULTIPOINT,
* LINESTRING, MULTILINESTRING, POLYGON, MULTIPOLYGON, and * LINESTRING, MULTILINESTRING, POLYGON, MULTIPOLYGON, and
* GEOMETRYCOLLECTION. * GEOMETRYCOLLECTION.
* @param {String} wkt A WKT string *
* @returns {OpenLayers.Feature.Vector|Array} A feature or array of * Parameters:
* features for * wkt - {String} A WKT string
* GEOMETRYCOLLECTION WKT. *
* Return:
* {<OpenLayers.Feature.Vector>|Array} A feature or array of features for
* GEOMETRYCOLLECTION WKT.
*/ */
read: function(wkt) { read: function(wkt) {
var features, type, str; var features, type, str;
@@ -48,10 +66,15 @@ OpenLayers.Format.WKT.prototype =
}, },
/** /**
* Method: write
* Serialize a feature or array of features into a WKT string. * Serialize a feature or array of features into a WKT string.
* @param {OpenLayers.Feature.Vector|Array} features A feature or array of *
* features * Parameters:
* @returns {String} The WKT string representation of the input geometries * features - {<OpenLayers.Feature.Vector>|Array} A feature or array of
* features
*
* Return:
* {String} The WKT string representation of the input geometries
*/ */
write: function(features) { write: function(features) {
var collection, geometry, type, data, isCollection; var collection, geometry, type, data, isCollection;
@@ -91,7 +114,7 @@ OpenLayers.Format.WKT.prototype =
extract: { extract: {
/** /**
* Return a space delimited string of point coordinates. * Return a space delimited string of point coordinates.
* @param {OpenLayers.Geometry.Point} point * @param {<OpenLayers.Geometry.Point>} point
* @returns {String} A string of coordinates representing the point * @returns {String} A string of coordinates representing the point
*/ */
'point': function(point) { 'point': function(point) {
@@ -100,7 +123,7 @@ OpenLayers.Format.WKT.prototype =
/** /**
* Return a comma delimited string of point coordinates from a multipoint. * Return a comma delimited string of point coordinates from a multipoint.
* @param {OpenLayers.Geometry.MultiPoint} multipoint * @param {<OpenLayers.Geometry.MultiPoint>} multipoint
* @returns {String} A string of point coordinate strings representing * @returns {String} A string of point coordinate strings representing
* the multipoint * the multipoint
*/ */
@@ -114,7 +137,7 @@ OpenLayers.Format.WKT.prototype =
/** /**
* Return a comma delimited string of point coordinates from a line. * Return a comma delimited string of point coordinates from a line.
* @param {OpenLayers.Geometry.LineString} linestring * @param {<OpenLayers.Geometry.LineString>} linestring
* @returns {String} A string of point coordinate strings representing * @returns {String} A string of point coordinate strings representing
* the linestring * the linestring
*/ */
@@ -128,7 +151,7 @@ OpenLayers.Format.WKT.prototype =
/** /**
* Return a comma delimited string of linestring strings from a multilinestring. * Return a comma delimited string of linestring strings from a multilinestring.
* @param {OpenLayers.Geometry.MultiLineString} multilinestring * @param {<OpenLayers.Geometry.MultiLineString>} multilinestring
* @returns {String} A string of of linestring strings representing * @returns {String} A string of of linestring strings representing
* the multilinestring * the multilinestring
*/ */
@@ -144,7 +167,7 @@ OpenLayers.Format.WKT.prototype =
/** /**
* Return a comma delimited string of linear ring arrays from a polygon. * Return a comma delimited string of linear ring arrays from a polygon.
* @param {OpenLayers.Geometry.Polygon} polygon * @param {<OpenLayers.Geometry.Polygon>} polygon
* @returns {String} An array of linear ring arrays representing the polygon * @returns {String} An array of linear ring arrays representing the polygon
*/ */
'polygon': function(polygon) { 'polygon': function(polygon) {
@@ -159,7 +182,7 @@ OpenLayers.Format.WKT.prototype =
/** /**
* Return an array of polygon arrays from a multipolygon. * Return an array of polygon arrays from a multipolygon.
* @param {OpenLayers.Geometry.MultiPolygon} multipolygon * @param {<OpenLayers.Geometry.MultiPolygon>} multipolygon
* @returns {Array} An array of polygon arrays representing * @returns {Array} An array of polygon arrays representing
* the multipolygon * the multipolygon
*/ */
@@ -183,7 +206,7 @@ OpenLayers.Format.WKT.prototype =
/** /**
* Return point feature given a point WKT fragment. * Return point feature given a point WKT fragment.
* @param {String} str A WKT fragment representing the point * @param {String} str A WKT fragment representing the point
* @returns {OpenLayers.Feature.Vector} A point feature * @returns {<OpenLayers.Feature.Vector>} A point feature
* @private * @private
*/ */
'point': function(str) { 'point': function(str) {
@@ -196,7 +219,7 @@ OpenLayers.Format.WKT.prototype =
/** /**
* Return a multipoint feature given a multipoint WKT fragment. * Return a multipoint feature given a multipoint WKT fragment.
* @param {String} A WKT fragment representing the multipoint * @param {String} A WKT fragment representing the multipoint
* @returns {OpenLayers.Feature.Vector} A multipoint feature * @returns {<OpenLayers.Feature.Vector>} A multipoint feature
* @private * @private
*/ */
'multipoint': function(str) { 'multipoint': function(str) {
@@ -213,7 +236,7 @@ OpenLayers.Format.WKT.prototype =
/** /**
* Return a linestring feature given a linestring WKT fragment. * Return a linestring feature given a linestring WKT fragment.
* @param {String} A WKT fragment representing the linestring * @param {String} A WKT fragment representing the linestring
* @returns {OpenLayers.Feature.Vector} A linestring feature * @returns {<OpenLayers.Feature.Vector>} A linestring feature
* @private * @private
*/ */
'linestring': function(str) { 'linestring': function(str) {
@@ -230,7 +253,7 @@ OpenLayers.Format.WKT.prototype =
/** /**
* Return a multilinestring feature given a multilinestring WKT fragment. * Return a multilinestring feature given a multilinestring WKT fragment.
* @param {String} A WKT fragment representing the multilinestring * @param {String} A WKT fragment representing the multilinestring
* @returns {OpenLayers.Feature.Vector} A multilinestring feature * @returns {<OpenLayers.Feature.Vector>} A multilinestring feature
* @private * @private
*/ */
'multilinestring': function(str) { 'multilinestring': function(str) {
@@ -249,7 +272,7 @@ OpenLayers.Format.WKT.prototype =
/** /**
* Return a polygon feature given a polygon WKT fragment. * Return a polygon feature given a polygon WKT fragment.
* @param {String} A WKT fragment representing the polygon * @param {String} A WKT fragment representing the polygon
* @returns {OpenLayers.Feature.Vector} A polygon feature * @returns {<OpenLayers.Feature.Vector>} A polygon feature
* @private * @private
*/ */
'polygon': function(str) { 'polygon': function(str) {
@@ -270,7 +293,7 @@ OpenLayers.Format.WKT.prototype =
/** /**
* Return a multipolygon feature given a multipolygon WKT fragment. * Return a multipolygon feature given a multipolygon WKT fragment.
* @param {String} A WKT fragment representing the multipolygon * @param {String} A WKT fragment representing the multipolygon
* @returns {OpenLayers.Feature.Vector} A multipolygon feature * @returns {<OpenLayers.Feature.Vector>} A multipolygon feature
* @private * @private
*/ */
'multipolygon': function(str) { 'multipolygon': function(str) {
+59 -28
View File
@@ -3,45 +3,58 @@
* for the full text of the license. */ * for the full text of the license. */
/** /**
* @class
* @requires OpenLayers/Format/WKT.js * @requires OpenLayers/Format/WKT.js
* @requires OpenLayers/Feature/Vector.js * @requires OpenLayers/Feature/Vector.js
*
* Class: OpenLayers.Geometry
* A Geometry is a description of a geographic object. Create an instance of
* this class with the <OpenLayers.Geometry> constructor. This is a base class,
* typical geometry types are described by subclasses of this class.
*/ */
OpenLayers.Geometry = OpenLayers.Class.create(); OpenLayers.Geometry = OpenLayers.Class.create();
OpenLayers.Geometry.prototype = { OpenLayers.Geometry.prototype = {
/** @type String */ /**
* Property: id
* {String} A unique identifier for this geometry.
*/
id: null, id: null,
/** This is set when a Geometry is added as Component of another Geometry /**
* * Property: parent
* @type OpenLayers.Geometry */ * {<OpenLayers.Geometry>}This is set when a Geometry is added as component
* of another geometry
*/
parent: null, parent: null,
/** @type OpenLayers.Bounds */ /**
* Property: bounds
* {<OpenLayers.Bounds>} The bounds of this geometry
*/
bounds: null, bounds: null,
/** /**
* @constructor * Constructor: OpenLayers.Geometry
* Creates a geometry object.
*/ */
initialize: function() { initialize: function() {
this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME+ "_"); this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME+ "_");
}, },
/** /**
* * Method: destroy
* Destroy this geometry.
*/ */
destroy: function() { destroy: function() {
this.id = null; this.id = null;
this.bounds = null; this.bounds = null;
}, },
/** /**
* Set the bounds for this Geometry. * Set the bounds for this Geometry.
* *
* @param {OpenLayers.Bounds} object * Parameters:
* object - {<OpenLayers.Bounds>}
*/ */
setBounds: function(bounds) { setBounds: function(bounds) {
if (bounds) { if (bounds) {
@@ -50,6 +63,7 @@ OpenLayers.Geometry.prototype = {
}, },
/** /**
* Method: clearBounds
* Nullify this components bounds and that of its parent as well. * Nullify this components bounds and that of its parent as well.
*/ */
clearBounds: function() { clearBounds: function() {
@@ -60,10 +74,12 @@ OpenLayers.Geometry.prototype = {
}, },
/** /**
* Method: extendBounds
* Extend the existing bounds to include the new bounds. * Extend the existing bounds to include the new bounds.
* If geometry's bounds is not yet set, then set a new Bounds. * If geometry's bounds is not yet set, then set a new Bounds.
* *
* @param {OpenLayers.Bounds} newBounds * Parameters:
* newBounds - {<OpenLayers.Bounds>}
*/ */
extendBounds: function(newBounds){ extendBounds: function(newBounds){
var bounds = this.getBounds(); var bounds = this.getBounds();
@@ -75,10 +91,12 @@ OpenLayers.Geometry.prototype = {
}, },
/** /**
* APIMethod: getBounds
* Get the bounds for this Geometry. If bounds is not set, it * Get the bounds for this Geometry. If bounds is not set, it
* is calculated again, this makes queries faster. * is calculated again, this makes queries faster.
* *
* @type OpenLayers.Bounds * Return:
* {<OpenLayers.Bounds>}
*/ */
getBounds: function() { getBounds: function() {
if (this.bounds == null) { if (this.bounds == null) {
@@ -87,8 +105,9 @@ OpenLayers.Geometry.prototype = {
return this.bounds; return this.bounds;
}, },
/** Recalculate the bounds for the geometry. /**
* * APIMethod: calculateBounds
* Recalculate the bounds for the geometry.
*/ */
calculateBounds: function() { calculateBounds: function() {
// //
@@ -97,15 +116,17 @@ OpenLayers.Geometry.prototype = {
}, },
/** /**
* Note: This is only an approximation based on the bounds of the * Method: atPoint
* Note - This is only an approximation based on the bounds of the
* geometry. * geometry.
* *
* @param {OpenLayers.LonLat} lonlat * Parameters:
* @param {float} toleranceLon Optional tolerance in Geometric Coords * lonlat - {<OpenLayers.LonLat>}
* @param {float} toleranceLat Optional tolerance in Geographic Coords * toleranceLon - {float} Optional tolerance in Geometric Coords
* toleranceLat - {float} Optional tolerance in Geographic Coords
* *
* @returns Whether or not the geometry is at the specified location * Return:
* @type Boolean * {Boolean} Whether or not the geometry is at the specified location
*/ */
atPoint: function(lonlat, toleranceLon, toleranceLat) { atPoint: function(lonlat, toleranceLon, toleranceLat) {
var atPoint = false; var atPoint = false;
@@ -127,8 +148,12 @@ OpenLayers.Geometry.prototype = {
}, },
/** /**
* @returns The length of the geometry * Method: getLength
* @type float * Calculate the length of this geometry. This method is defined in
* subclasses.
*
* Return:
* {Float} The length of the collection by summing its parts
*/ */
getLength: function() { getLength: function() {
//to be overridden by geometries that actually have a length //to be overridden by geometries that actually have a length
@@ -137,8 +162,11 @@ OpenLayers.Geometry.prototype = {
}, },
/** /**
* @returns The area of the geometry * Method: getArea
* @type float * Calculate the area of this geometry. This method is defined in subclasses.
*
* Return:
* {Float} The area of the collection by summing its parts
*/ */
getArea: function() { getArea: function() {
//to be overridden by geometries that actually have an area //to be overridden by geometries that actually have an area
@@ -147,8 +175,11 @@ OpenLayers.Geometry.prototype = {
}, },
/** /**
* @returns the Well-Known Text representation of a geometry * Method: toString
* @type String * Returns the Well-Known Text representation of a geometry
*
* Return:
* {String} Well-Known Text
*/ */
toString: function() { toString: function() {
return OpenLayers.Format.WKT.prototype.write( return OpenLayers.Format.WKT.prototype.write(
@@ -156,6 +187,6 @@ OpenLayers.Geometry.prototype = {
); );
}, },
/** @final @type String */ /** @final @type String*/
CLASS_NAME: "OpenLayers.Geometry" CLASS_NAME: "OpenLayers.Geometry"
}; };
+91 -43
View File
@@ -3,40 +3,50 @@
* for the full text of the license. */ * for the full text of the license. */
/** /**
* @class * @requires OpenLayers/Geometry.js
* *
* Class: OpenLayers.Geometry.Collection
* A Collection is exactly what it sounds like: A collection of different * A Collection is exactly what it sounds like: A collection of different
* Geometries. These are stored in the local parameter "components" (which * Geometries. These are stored in the local parameter <components> (which
* can be passed as a parameter to the constructor). * can be passed as a parameter to the constructor).
* *
* As new geometries are added to the collection, they are NOT cloned. * As new geometries are added to the collection, they are NOT cloned.
* When removing geometries, they need to be specified by reference (ie you * When removing geometries, they need to be specified by reference (ie you
* have to pass in the *exact* geometry to be removed). * have to pass in the *exact* geometry to be removed).
* *
* The getArea() and getLength() functions here merely iterate through * The <getArea> and <getLength> functions here merely iterate through
* the components, summing their respective areas and lengths. * the components, summing their respective areas and lengths.
* *
* @requires OpenLayers/Geometry.js * Create a new instance with the <OpenLayers.Geometry.Collection> constructor.
*
* Inerhits from:
* - <OpenLayers.Geometry>
*/ */
OpenLayers.Geometry.Collection = OpenLayers.Class.create(); OpenLayers.Geometry.Collection = OpenLayers.Class.create();
OpenLayers.Geometry.Collection.prototype = OpenLayers.Geometry.Collection.prototype =
OpenLayers.Class.inherit( OpenLayers.Geometry, { OpenLayers.Class.inherit( OpenLayers.Geometry, {
/** @type Array(OpenLayers.Geometry) */ /**
* APIProperty: components
* {Array(<OpenLayers.Geometry>)} The component parts of this geometry
*/
components: null, components: null,
/** /**
* An array of class names representing the types of components that * Property: componentTypes
* the collection can include. A null value means the component types * {Array(String)} An array of class names representing the types of
* are not restricted. * components that the collection can include. A null value means the
* @type Array(String) * component types are not restricted.
*/ */
componentTypes: null, componentTypes: null,
/** /**
* @constructor * Constructor: OpenLayers.Geometry.Collection
* * Creates a Geometry Collection -- a list of geoms.
* @param {Array(OpenLayers.Geometry)} components *
* Parameters:
* components - {Array(<OpenLayers.Geometry>)} Optional array of geometries
*
*/ */
initialize: function (components) { initialize: function (components) {
OpenLayers.Geometry.prototype.initialize.apply(this, arguments); OpenLayers.Geometry.prototype.initialize.apply(this, arguments);
@@ -47,7 +57,8 @@ OpenLayers.Geometry.Collection.prototype =
}, },
/** /**
* * APIMethod: destroy
* Destroy this geometry.
*/ */
destroy: function () { destroy: function () {
this.components.length = 0; this.components.length = 0;
@@ -55,8 +66,11 @@ OpenLayers.Geometry.Collection.prototype =
}, },
/** /**
* @returns An exact clone of this collection * APIMethod: clone
* @type OpenLayers.Geometry.Collection * Clone this geometry.
*
* Return:
* {<OpenLayers.Geometry.Collection>} An exact clone of this collection
*/ */
clone: function() { clone: function() {
var geometry = eval("new " + this.CLASS_NAME + "()"); var geometry = eval("new " + this.CLASS_NAME + "()");
@@ -71,8 +85,11 @@ OpenLayers.Geometry.Collection.prototype =
}, },
/** /**
* @returns the components of the geometry * Method: getComponentsString
* @type String * Get a string representing the components for this collection
*
* Return:
* {String} A string representation of the components of this geometry
*/ */
getComponentsString: function(){ getComponentsString: function(){
var strings = []; var strings = [];
@@ -82,9 +99,10 @@ OpenLayers.Geometry.Collection.prototype =
return strings.join(","); return strings.join(",");
}, },
/** Recalculate the bounds by iterating through the components and /**
* calling calling extendBounds() on each item * APIMethod: calculateBounds
* * Recalculate the bounds by iterating through the components and
* calling calling extendBounds() on each item.
*/ */
calculateBounds: function() { calculateBounds: function() {
this.bounds = null; this.bounds = null;
@@ -97,8 +115,11 @@ OpenLayers.Geometry.Collection.prototype =
}, },
/** /**
* @param {Array(OpenLayers.Geometry)} components * APIMethod: addComponents
* * Add components to this geometry.
*
* Parameters:
* components - {Array(<OpenLayers.Geometry>)} An array of geometries to add
*/ */
addComponents: function(components){ addComponents: function(components){
if(!(components instanceof Array)) { if(!(components instanceof Array)) {
@@ -110,16 +131,19 @@ OpenLayers.Geometry.Collection.prototype =
}, },
/** /**
* Method: addComponent
* Add a new component (geometry) to the collection. If this.componentTypes * Add a new component (geometry) to the collection. If this.componentTypes
* is set, then the component class name must be in the componentTypes array. * is set, then the component class name must be in the componentTypes array.
* *
* The bounds cache is reset. * The bounds cache is reset.
* *
* @param {OpenLayers.Geometry} component * Parameters:
* @param {int} index Index into the array to insert the component * component - {<OpenLayers.Geometry>} A geometry to add
* @type Boolean * index - {int} Optional index into the array to insert the component
* @return Component was successfully added *
*/ * Return:
* {Boolean} The component geometry was successfully added
*/
addComponent: function(component, index) { addComponent: function(component, index) {
var added = false; var added = false;
if(component) { if(component) {
@@ -145,7 +169,11 @@ OpenLayers.Geometry.Collection.prototype =
}, },
/** /**
* @param {Array(OpenLayers.Geometry)} components * APIMethod: removeComponents
* Remove components from this geometry.
*
* Parameters:
* components - {Array(<OpenLayers.Geometry>)} The components to be removed
*/ */
removeComponents: function(components) { removeComponents: function(components) {
if(!(components instanceof Array)) { if(!(components instanceof Array)) {
@@ -157,7 +185,11 @@ OpenLayers.Geometry.Collection.prototype =
}, },
/** /**
* @param {OpenLayers.Geometry} component * Method: removeComponent
* Remove a component from this geometry.
*
* Parameters:
* component - {<OpenLayers.Geometry>}
*/ */
removeComponent: function(component) { removeComponent: function(component) {
@@ -169,8 +201,11 @@ OpenLayers.Geometry.Collection.prototype =
}, },
/** /**
* @returns The length of the geometry * APIMethod: getLength
* @type float * Calculate the length of this geometry
*
* Return:
* {Float} The length of the geometry
*/ */
getLength: function() { getLength: function() {
var length = 0.0; var length = 0.0;
@@ -180,10 +215,13 @@ OpenLayers.Geometry.Collection.prototype =
return length; return length;
}, },
/** Note how this function is overridden in Polygon /**
* * APIMethod: getArea
* @returns the area of the collection by summing its parts * Calculate the area of this geometry. Note how this function is overridden
* @type float * in <OpenLayers.Geometry.Polygon>.
*
* Return:
* {Float} The area of the collection by summing its parts
*/ */
getArea: function() { getArea: function() {
var area = 0.0; var area = 0.0;
@@ -194,9 +232,12 @@ OpenLayers.Geometry.Collection.prototype =
}, },
/** /**
* APIMethod: move
* Moves a collection in place * Moves a collection in place
* @param {Float} x *
* @param {Float} y * Parameters:
* x - {Float} The x-displacement (in map units)
* y - {Float} The y-displacement (in map units)
*/ */
move: function(x, y) { move: function(x, y) {
for(var i = 0; i < this.components.length; i++) { for(var i = 0; i < this.components.length; i++) {
@@ -205,10 +246,14 @@ OpenLayers.Geometry.Collection.prototype =
}, },
/** /**
* APIMethod: equals
* Tests for equivalent geometries * Tests for equivalent geometries
* @param {OpenLayers.Geometry} *
* @type Boolean * Parameters:
* @return The coordinates are equivalent * geometry - {<OpenLayers.Geometry>}
*
* Return:
* {Boolean} The coordinates are equivalent
*/ */
equals: function(geometry) { equals: function(geometry) {
var equivalent = true; var equivalent = true;
@@ -228,6 +273,9 @@ OpenLayers.Geometry.Collection.prototype =
return equivalent; return equivalent;
}, },
/** @final @type String */ /**
* Constant: CLASS_NAME
* {String} Name of class.
*/
CLASS_NAME: "OpenLayers.Geometry.Collection" CLASS_NAME: "OpenLayers.Geometry.Collection"
}); });
+17 -12
View File
@@ -3,30 +3,33 @@
* for the full text of the license. */ * for the full text of the license. */
/** /**
* @class * @requires OpenLayers/Geometry/MultiPoint.js
* *
* Class: OpenLayers.Geometry.Curve
* A Curve is a MultiPoint, whose points are assumed to be connected. To * A Curve is a MultiPoint, whose points are assumed to be connected. To
* this end, we provide a "getLength()" function, which iterates through * this end, we provide a "getLength()" function, which iterates through
* the points, summing the distances between them. * the points, summing the distances between them.
* *
* @requires OpenLayers/Geometry/MultiPoint.js * Inherits:
* - <OpenLayers.Geometry.MultiPoint>
*/ */
OpenLayers.Geometry.Curve = OpenLayers.Class.create(); OpenLayers.Geometry.Curve = OpenLayers.Class.create();
OpenLayers.Geometry.Curve.prototype = OpenLayers.Geometry.Curve.prototype =
OpenLayers.Class.inherit(OpenLayers.Geometry.MultiPoint, { OpenLayers.Class.inherit(OpenLayers.Geometry.MultiPoint, {
/** /**
* An array of class names representing the types of components that * Property: componentTypes
* the collection can include. A null value means the component types * {Array(String)} An array of class names representing the types of
* are not restricted. * components that the collection can include. A null
* @type Array(String) * value means the component types are not restricted.
*/ */
componentTypes: ["OpenLayers.Geometry.Point"], componentTypes: ["OpenLayers.Geometry.Point"],
/** /**
* @constructor * Constructor: OpenLayers.Geometry.Curve
* *
* @param {Array(OpenLayers.Geometry.Point)} points * Parameters:
* point - {Array(<OpenLayers.Geometry.Point>)}
*/ */
initialize: function(points) { initialize: function(points) {
OpenLayers.Geometry.MultiPoint.prototype.initialize.apply(this, OpenLayers.Geometry.MultiPoint.prototype.initialize.apply(this,
@@ -34,8 +37,10 @@ OpenLayers.Geometry.Curve.prototype =
}, },
/** /**
* @returns The length of the curve * APIMethod: getLength
* @type float *
* Return:
* {Float} The length of the curve
*/ */
getLength: function() { getLength: function() {
var length = 0.0; var length = 0.0;
+23 -11
View File
@@ -3,30 +3,39 @@
* for the full text of the license. */ * for the full text of the license. */
/** /**
* @class * @requires OpenLayers/Geometry/Curve.js
* *
* Class: OpenLayers.Geometry.LineString
* A LineString is a Curve which, once two points have been added to it, can * A LineString is a Curve which, once two points have been added to it, can
* never be less than two points long. * never be less than two points long.
* *
* @requires OpenLayers/Geometry/Curve.js * Inherits from:
* - <OpenLayers.Geometry.Curve>
*/ */
OpenLayers.Geometry.LineString = OpenLayers.Class.create(); OpenLayers.Geometry.LineString = OpenLayers.Class.create();
OpenLayers.Geometry.LineString.prototype = OpenLayers.Geometry.LineString.prototype =
OpenLayers.Class.inherit(OpenLayers.Geometry.Curve, { OpenLayers.Class.inherit(OpenLayers.Geometry.Curve, {
/** /**
* @constructor * Constructor: OpenLayers.Geometry.LineString
* * Create a new LineString geometry
* @param {Array(OpenLayers.Geometry.Point)} points *
* Parameters:
* points - {Array(<OpenLayers.Geometry.Point>)} An array of points used to
* generate the linestring
*
*/ */
initialize: function(points) { initialize: function(points) {
OpenLayers.Geometry.Curve.prototype.initialize.apply(this, arguments); OpenLayers.Geometry.Curve.prototype.initialize.apply(this, arguments);
}, },
/** Only allows removal of a point if there are three or more points in /**
* the linestring. (otherwise the result would be just a single point) * APIMethod: removeComponent
* * Only allows removal of a point if there are three or more points in
* @param {OpenLayers.Geometry.Point} point * the linestring. (otherwise the result would be just a single point)
*
* Parameters:
* point - {<OpenLayers.Geometry.Point>} The point to be removed
*/ */
removeComponent: function(point) { removeComponent: function(point) {
if ( this.components && (this.components.length > 2)) { if ( this.components && (this.components.length > 2)) {
@@ -35,6 +44,9 @@ OpenLayers.Geometry.LineString.prototype =
} }
}, },
/** @final @type String */ /**
* Constant: CLASS_NAME
* {String} Name of class.
*/
CLASS_NAME: "OpenLayers.Geometry.LineString" CLASS_NAME: "OpenLayers.Geometry.LineString"
}); });
+38 -26
View File
@@ -3,7 +3,9 @@
* for the full text of the license. */ * for the full text of the license. */
/** /**
* @class * @requires OpenLayers/Geometry/LineString.js
*
* Class: OpenLayers.Geometry.LinearRing
* *
* A Linear Ring is a special LineString which is closed. It closes itself * A Linear Ring is a special LineString which is closed. It closes itself
* automatically on every addPoint/removePoint by adding a copy of the first * automatically on every addPoint/removePoint by adding a copy of the first
@@ -12,29 +14,31 @@
* Also, as it is the first in the line family to close itself, a getArea() * Also, as it is the first in the line family to close itself, a getArea()
* function is defined to calculate the enclosed area of the linearRing * function is defined to calculate the enclosed area of the linearRing
* *
* @requires OpenLayers/Geometry/LineString.js * Inherits:
* - <OpenLayers.Geometry.LineString>
*/ */
OpenLayers.Geometry.LinearRing = OpenLayers.Class.create(); OpenLayers.Geometry.LinearRing = OpenLayers.Class.create();
OpenLayers.Geometry.LinearRing.prototype = OpenLayers.Geometry.LinearRing.prototype =
OpenLayers.Class.inherit(OpenLayers.Geometry.LineString, { OpenLayers.Class.inherit(OpenLayers.Geometry.LineString, {
/** /**
* An array of class names representing the types of components that * Property: componentTypes
* the collection can include. A null value means the component types * {Array(String)} An array of class names representing the types of
* are not restricted. * components that the collection can include. A null
* @type Array(String) * value means the component types are not restricted.
*/ */
componentTypes: ["OpenLayers.Geometry.Point"], componentTypes: ["OpenLayers.Geometry.Point"],
/** /**
* Constructor: OpenLayers.Geometry.LinearRing
* Linear rings are constructed with an array of points. This array * Linear rings are constructed with an array of points. This array
* can represent a closed or open ring. If the ring is open (the last * can represent a closed or open ring. If the ring is open (the last
* point does not equal the first point), the constructor will close * point does not equal the first point), the constructor will close
* the ring. If the ring is already closed (the last point does equal * the ring. If the ring is already closed (the last point does equal
* the first point), it will be left closed. * the first point), it will be left closed.
* *
* @constructor * Parameters:
* @param {Array(OpenLayers.Geometry.Point)} points * points - {Array(<OpenLayers.Geometry.Point>)} points
*/ */
initialize: function(points) { initialize: function(points) {
OpenLayers.Geometry.LineString.prototype.initialize.apply(this, OpenLayers.Geometry.LineString.prototype.initialize.apply(this,
@@ -42,17 +46,21 @@ OpenLayers.Geometry.LinearRing.prototype =
}, },
/** /**
* APIMethod: addComponent
* Adds a point to geometry components. If the point is to be added to * Adds a point to geometry components. If the point is to be added to
* the end of the components array and it is the same as the last point * the end of the components array and it is the same as the last point
* already in that array, the duplicate point is not added. This has the * already in that array, the duplicate point is not added. This has
* effect of closing the ring if it is not already closed, and doing the * the effect of closing the ring if it is not already closed, and
* right thing if it is already closed. This behavior can be overridden * doing the right thing if it is already closed. This behavior can
* by calling the method with a non-null index as the second argument. * be overridden by calling the method with a non-null index as the
* second argument.
* *
* @param {OpenLayers.Geometry.Point} point * Parameter:
* @param {int} index Index into the array to insert the component * point - {<OpenLayers.Geometry.Point>}
* @type Boolean * index - {Integer} Index into the array to insert the component
* @return Point was successfully added *
* Return:
* {Boolean} Was the Point successfully added?
*/ */
addComponent: function(point, index) { addComponent: function(point, index) {
var added = false; var added = false;
@@ -78,9 +86,11 @@ OpenLayers.Geometry.LinearRing.prototype =
}, },
/** /**
* Removes a point from geometry components * APIMethod: removeComponent
* Removes a point from geometry components.
* *
* @param {OpenLayers.Geometry.Point} point * Parameters:
* point - {<OpenLayers.Geometry.Point>}
*/ */
removeComponent: function(point) { removeComponent: function(point) {
if (this.components.length > 4) { if (this.components.length > 4) {
@@ -100,11 +110,13 @@ OpenLayers.Geometry.LinearRing.prototype =
} }
}, },
/** Note: The area is positive if the ring is oriented CW, otherwise /**
* APIMethod: getArea
* Note - The area is positive if the ring is oriented CW, otherwise
* it will be negative. * it will be negative.
* *
* @returns The signed area for a ring. * Return:
* @type float * {Float} The signed area for a ring.
*/ */
getArea: function() { getArea: function() {
var area = 0.0; var area = 0.0;
+21 -11
View File
@@ -3,34 +3,44 @@
* for the full text of the license. */ * for the full text of the license. */
/** /**
* @class
*
* A MultiLineString is a collection of LineStrings
*
* @requires OpenLayers/Geometry/Collection.js * @requires OpenLayers/Geometry/Collection.js
*
* Class: OpenLayers.Geometry.MultiLineString
* A MultiLineString is a geometry with multiple <OpenLayers.Geometry.LineString>
* components.
*
* Inherits from:
* - <OpenLayers.Geometry.Collection>
* - <OpenLayers.Geometry>
*/ */
OpenLayers.Geometry.MultiLineString = OpenLayers.Class.create(); OpenLayers.Geometry.MultiLineString = OpenLayers.Class.create();
OpenLayers.Geometry.MultiLineString.prototype = OpenLayers.Geometry.MultiLineString.prototype =
OpenLayers.Class.inherit(OpenLayers.Geometry.Collection, { OpenLayers.Class.inherit(OpenLayers.Geometry.Collection, {
/** /**
* An array of class names representing the types of components that * Property: componentTypes
* the collection can include. A null value means the component types * {Array(String)} An array of class names representing the types of
* are not restricted. * components that the collection can include. A null value means the
* @type Array(String) * component types are not restricted.
*/ */
componentTypes: ["OpenLayers.Geometry.LineString"], componentTypes: ["OpenLayers.Geometry.LineString"],
/** /**
* @constructor * Constructor: OpenLayers.Geometry.MultiLineString
* Constructor for a MultiLineString Geometry.
*
* Parameters:
* components - {Array(OpenLayers.Geometry.LineString)}
* *
* @param {Array(OpenLayers.Geometry.LineString)} components
*/ */
initialize: function(components) { initialize: function(components) {
OpenLayers.Geometry.Collection.prototype.initialize.apply(this, OpenLayers.Geometry.Collection.prototype.initialize.apply(this,
arguments); arguments);
}, },
/** @final @type String */ /**
* Constant: CLASS_NAME
* {String} Name of class.
*/
CLASS_NAME: "OpenLayers.Geometry.MultiLineString" CLASS_NAME: "OpenLayers.Geometry.MultiLineString"
}); });
+34 -17
View File
@@ -3,28 +3,37 @@
* for the full text of the license. */ * for the full text of the license. */
/** /**
* @class
*
* MultiPoint is a collection of Points.
*
* @requires OpenLayers/Geometry/Collection.js * @requires OpenLayers/Geometry/Collection.js
*
* Class: OpenLayers.Geometry.MultiPoint
* MultiPoint is a collection of Points. Create a new instance with the
* <OpenLayers.Geometry.MultiPoint> constructor.
*
* Inherits from:
* - <OpenLayers.Geometry.Collection>
* - <OpenLayers.Geometry>
*/ */
OpenLayers.Geometry.MultiPoint = OpenLayers.Class.create(); OpenLayers.Geometry.MultiPoint = OpenLayers.Class.create();
OpenLayers.Geometry.MultiPoint.prototype = OpenLayers.Geometry.MultiPoint.prototype =
OpenLayers.Class.inherit(OpenLayers.Geometry.Collection, { OpenLayers.Class.inherit(OpenLayers.Geometry.Collection, {
/** /**
* An array of class names representing the types of components that * Property: componentTypes
* the collection can include. A null value means the component types * {Array(String)} An array of class names representing the types of
* are not restricted. * components that the collection can include. A null value means the
* @type Array(String) * component types are not restricted.
*/ */
componentTypes: ["OpenLayers.Geometry.Point"], componentTypes: ["OpenLayers.Geometry.Point"],
/** /**
* @constructor * Constructor: OpenLayers.Geometry.MultiPoint
* Create a new MultiPoint Geometry
* *
* @param {Array(OpenLayers.Geometry.Point)} components * Parameters:
* components - Array({<OpenLayers.Geometry.Point>})
*
* Return:
* {<OpenLayers.Geometry.MultiPoint>}
*/ */
initialize: function(components) { initialize: function(components) {
OpenLayers.Geometry.Collection.prototype.initialize.apply(this, OpenLayers.Geometry.Collection.prototype.initialize.apply(this,
@@ -32,23 +41,31 @@ OpenLayers.Geometry.MultiPoint.prototype =
}, },
/** /**
* Wrapper for addComponent() * APIMethod: addPoint
* * Wrapper for <OpenLayers.Geometry.Collection.addComponent>
* @param {OpenLayers.Geometry.Point} point *
* @param {int} index * Parameters:
* point - {<OpenLayers.Geometry.Point>} Point to be added
* index - {Integer} Optional index
*/ */
addPoint: function(point, index) { addPoint: function(point, index) {
this.addComponent(point, index); this.addComponent(point, index);
}, },
/** /**
* Wrapper for removeComponent() * APIMethod: removePoint
* Wrapper for <OpenLayers.Geometry.Collection.removeComponent>
* *
* @param {OpenLayers.Geometry.Point} point * Parameters:
* point - {<OpenLayers.Geometry.Point>} Point to be removed
*/ */
removePoint: function(point){ removePoint: function(point){
this.removeComponent(point); this.removeComponent(point);
}, },
/** @final @type String */
/**
* Constant: CLASS_NAME
* {String} Name of class.
*/
CLASS_NAME: "OpenLayers.Geometry.MultiPoint" CLASS_NAME: "OpenLayers.Geometry.MultiPoint"
}); });
+24 -13
View File
@@ -3,34 +3,45 @@
* for the full text of the license. */ * for the full text of the license. */
/** /**
* @class
*
* MultiPolygon is a collection of Polygons.
*
* @requires OpenLayers/Geometry/Collection.js * @requires OpenLayers/Geometry/Collection.js
*
* Class: OpenLayers.Geometry.MultiPolygon
* MultiPolygon is a geometry with multiple <OpenLayers.Geometry.Polygon>
* components. Create a new instance with the <OpenLayers.Geometry.MultiPolygon>
* constructor.
*
* Inherits from:
* - <OpenLayers.Geometry.Collection>
*/ */
OpenLayers.Geometry.MultiPolygon = OpenLayers.Class.create(); OpenLayers.Geometry.MultiPolygon = OpenLayers.Class.create();
OpenLayers.Geometry.MultiPolygon.prototype = OpenLayers.Geometry.MultiPolygon.prototype =
OpenLayers.Class.inherit(OpenLayers.Geometry.Collection, { OpenLayers.Class.inherit(OpenLayers.Geometry.Collection, {
/** /**
* An array of class names representing the types of components that * Property: componentTypes
* the collection can include. A null value means the component types * {Array(String)} An array of class names representing the types of
* are not restricted. * components that the collection can include. A null value means the
* @type Array(String) * component types are not restricted.
*/ */
componentTypes: ["OpenLayers.Geometry.Polygon"], componentTypes: ["OpenLayers.Geometry.Polygon"],
/** /**
* @constructor * Constructor: OpenLayers.Geometry.MultiPolygon
* * Create a new MultiPolygon geometry
* @param {Array(OpenLayers.Geometry.Polygon)} components *
*/ * Parameters:
* components - {Array(<OpenLayers.Geometry.Polygon>)} An array of polygons
* used to generate the MultiPolygon
*
*/
initialize: function(components) { initialize: function(components) {
OpenLayers.Geometry.Collection.prototype.initialize.apply(this, OpenLayers.Geometry.Collection.prototype.initialize.apply(this,
arguments); arguments);
}, },
/** @final @type String */ /**
* Constant: CLASS_NAME
* {String} Name of class.
*/
CLASS_NAME: "OpenLayers.Geometry.MultiPolygon" CLASS_NAME: "OpenLayers.Geometry.MultiPolygon"
}); });
+51 -21
View File
@@ -3,25 +3,38 @@
* for the full text of the license. */ * for the full text of the license. */
/** /**
* @class
*
* @requires OpenLayers/Geometry.js * @requires OpenLayers/Geometry.js
*
* Class: OpenLayers.Geometry.Point
* Point geometry class.
*
* Inherits from:
* - <OpenLayers.Geometry>
*/ */
OpenLayers.Geometry.Point = OpenLayers.Class.create(); OpenLayers.Geometry.Point = OpenLayers.Class.create();
OpenLayers.Geometry.Point.prototype = OpenLayers.Geometry.Point.prototype =
OpenLayers.Class.inherit(OpenLayers.Geometry, { OpenLayers.Class.inherit(OpenLayers.Geometry, {
/** @type float */ /**
* APIProperty: x
* {float}
*/
x: null, x: null,
/** @type float */ /**
* APIProperty: y
* {float}
*/
y: null, y: null,
/** /**
* @constructor * Constructor: OpenLayers.Geometry.Point
* Construct a point geometry.
* *
* @param {float} x * Parameters:
* @param {float} y * x - {float}
* y - {float}
*
*/ */
initialize: function(x, y) { initialize: function(x, y) {
OpenLayers.Geometry.prototype.initialize.apply(this, arguments); OpenLayers.Geometry.prototype.initialize.apply(this, arguments);
@@ -31,8 +44,10 @@ OpenLayers.Geometry.Point.prototype =
}, },
/** /**
* @returns An exact clone of this OpenLayers.Geometry.Point * APIMethod: clone
* @type OpenLayers.Geometry.Point *
* Return:
* {<OpenLayers.Geometry.Point>} An exact clone of this OpenLayers.Geometry.Point
*/ */
clone: function(obj) { clone: function(obj) {
if (obj == null) { if (obj == null) {
@@ -45,8 +60,9 @@ OpenLayers.Geometry.Point.prototype =
return obj; return obj;
}, },
/** Create a new Bounds based on the lon/lat /**
* * Method: calculateBounds
* Create a new Bounds based on the lon/lat
*/ */
calculateBounds: function () { calculateBounds: function () {
this.bounds = new OpenLayers.Bounds(this.x, this.y, this.bounds = new OpenLayers.Bounds(this.x, this.y,
@@ -54,7 +70,10 @@ OpenLayers.Geometry.Point.prototype =
}, },
/** /**
* @param {OpenLayers.Geometry.Point} point * APIMethod: distanceTo
*
* Parameters:
* point - {<OpenLayers.Geometry.Point>}
*/ */
distanceTo: function(point) { distanceTo: function(point) {
var distance = 0.0; var distance = 0.0;
@@ -69,12 +88,16 @@ OpenLayers.Geometry.Point.prototype =
}, },
/** /**
* @param {OpenLayers.Geometry} xy * APIMethod: equals
* @returns Boolean value indicating whether the passed-in *
* OpenLayers.Geometryobject has the same components as this * Parameters:
* xy - {<OpenLayers.Geometry>}
*
* Return:
* {Boolean} Boolean value indicating whether the passed-in
* {<OpenLayers.Geometry>} object has the same components as this
* note that if ll passed in is null, returns false * note that if ll passed in is null, returns false
* *
* @type bool
*/ */
equals:function(geom) { equals:function(geom) {
var equals = false; var equals = false;
@@ -86,24 +109,31 @@ OpenLayers.Geometry.Point.prototype =
}, },
/** /**
* @return Shortened String representation of Point object. * Method: toShortString
*
* Return:
* {String} Shortened String representation of Point object.
* (ex. <i>"5, 42"</i>) * (ex. <i>"5, 42"</i>)
* @type String
*/ */
toShortString: function() { toShortString: function() {
return (this.x + ", " + this.y); return (this.x + ", " + this.y);
}, },
/** /**
* APIMethod: move
* Moves a point in place * Moves a point in place
* @param {Float} x *
* @param {Float} y * Parameters:
* x - {Float}
* y - {Float}
*/ */
move: function(x, y) { move: function(x, y) {
this.x = this.x + x; this.x = this.x + x;
this.y = this.y + y; this.y = this.y + y;
}, },
/** @final @type String */ /** Constant: CLASS_NAME
* {String} Name of this class
*/
CLASS_NAME: "OpenLayers.Geometry.Point" CLASS_NAME: "OpenLayers.Geometry.Point"
}); });
+25 -15
View File
@@ -3,42 +3,49 @@
* for the full text of the license. */ * for the full text of the license. */
/** /**
* @class * @requires OpenLayers/Geometry/Collection.js
* *
* Class: OpenLayers.Geometry.Polygon
* Polygon is a collection of Geometry.LinearRings. * Polygon is a collection of Geometry.LinearRings.
* *
* The first ring (this.component[0])is the outer bounds of the polygon and * Inherits from:
* all subsequent rings (this.component[1-n]) are internal holes. * - <OpenLayers.Geometry.Collection>
* * - <OpenLayers.Geometry>
* @requires OpenLayers/Geometry/Collection.js
*/ */
OpenLayers.Geometry.Polygon = OpenLayers.Class.create(); OpenLayers.Geometry.Polygon = OpenLayers.Class.create();
OpenLayers.Geometry.Polygon.prototype = OpenLayers.Geometry.Polygon.prototype =
OpenLayers.Class.inherit(OpenLayers.Geometry.Collection, { OpenLayers.Class.inherit(OpenLayers.Geometry.Collection, {
/** /**
* An array of class names representing the types of components that * Property: componentTypes
* the collection can include. A null value means the component types * {Array(String)} An array of class names representing the types of
* are not restricted. * components that the collection can include. A null value means the
* @type Array(String) * component types are not restricted.
*/ */
componentTypes: ["OpenLayers.Geometry.LinearRing"], componentTypes: ["OpenLayers.Geometry.LinearRing"],
/** /**
* @constructor * Constructor: OpenLayers.Geometry.Polygon
* Constructor for a Polygon geometry.
* The first ring (this.component[0])is the outer bounds of the polygon and
* all subsequent rings (this.component[1-n]) are internal holes.
* *
* @param {Array(OpenLayers.Geometry.LinearRing)} *
* Parameters:
* components - Array({<OpenLayers.Geometry.LinearRing>})
*/ */
initialize: function(components) { initialize: function(components) {
OpenLayers.Geometry.Collection.prototype.initialize.apply(this, OpenLayers.Geometry.Collection.prototype.initialize.apply(this,
arguments); arguments);
}, },
/** Calculated by subtracting the areas of the internal holes from the /**
* APIMethod: getArea
* Calculated by subtracting the areas of the internal holes from the
* area of the outer hole. * area of the outer hole.
* *
* @returns The area of the geometry * Return:
* @type float * {float} The area of the geometry
*/ */
getArea: function() { getArea: function() {
var area = 0.0; var area = 0.0;
@@ -51,6 +58,9 @@ OpenLayers.Geometry.Polygon.prototype =
return area; return area;
}, },
/** @final @type String */ /**
* Constant: CLASS_NAME
* {String} Name of class.
*/
CLASS_NAME: "OpenLayers.Geometry.Polygon" CLASS_NAME: "OpenLayers.Geometry.Polygon"
}); });
+38 -18
View File
@@ -3,35 +3,50 @@
* for the full text of the license. */ * for the full text of the license. */
/** /**
* @class
*
* A Rectangle is a simple geometry. It is specified by a a point (x and y)
* and dimensions (width and height), all of which are directly accessible as
* properties.
*
* @requires OpenLayers/Geometry.js * @requires OpenLayers/Geometry.js
*
* Class: OpenLayers.Geometry.Rectangle
* A Rectangle is a simple geometry. It is specified by a a point (x and y)
* and dimensions (width and height), all of which are directly accessible
* as properties.
*
* Inherits:
* - <OpenLayers.Geometry>
*/ */
OpenLayers.Geometry.Rectangle = OpenLayers.Class.create(); OpenLayers.Geometry.Rectangle = OpenLayers.Class.create();
OpenLayers.Geometry.Rectangle.prototype = OpenLayers.Geometry.Rectangle.prototype =
OpenLayers.Class.inherit(OpenLayers.Geometry, { OpenLayers.Class.inherit(OpenLayers.Geometry, {
/** @type float */ /**
* Property: x
* {Float}
*/
x: null, x: null,
/** @type float */ /**
* Property: y
* {Float}
*/
y: null, y: null,
/** @type float */ /**
* Property: width
* {Float}
*/
width: null, width: null,
/** @type float */ /**
* Property: height
* {Float}
*/
height: null, height: null,
/** /**
* @constructor * Constructor: OpenLayers.Geometry.Rectangle
* *
* @param {array} points * Parameters:
* points - {Array(<OpenLayers.Geometry.Point>}
*/ */
initialize: function(x, y, width, height) { initialize: function(x, y, width, height) {
OpenLayers.Geometry.prototype.initialize.apply(this, arguments); OpenLayers.Geometry.prototype.initialize.apply(this, arguments);
@@ -44,7 +59,8 @@ OpenLayers.Geometry.Rectangle.prototype =
}, },
/** /**
* * Method: calculateBounds
* Recalculate the bounds for the geometry.
*/ */
calculateBounds: function() { calculateBounds: function() {
this.bounds = new OpenLayers.Bounds(this.x, this.y, this.bounds = new OpenLayers.Bounds(this.x, this.y,
@@ -54,8 +70,10 @@ OpenLayers.Geometry.Rectangle.prototype =
/** /**
* @returns The length of the geometry * APIMethod: getLength
* @type float *
* Return:
* {Float} The length of the geometry
*/ */
getLength: function() { getLength: function() {
var length = (2 * this.width) + (2 * this.height); var length = (2 * this.width) + (2 * this.height);
@@ -63,8 +81,10 @@ OpenLayers.Geometry.Rectangle.prototype =
}, },
/** /**
* @returns The area of the geometry * APIMethod: getArea
* @type float *
* Return:
* {Float} The area of the geometry
*/ */
getArea: function() { getArea: function() {
var area = this.width * this.height; var area = this.width * this.height;
+3 -4
View File
@@ -3,23 +3,22 @@
* for the full text of the license. */ * for the full text of the license. */
/** /**
* @class
*
* @requires OpenLayers/Geometry.js * @requires OpenLayers/Geometry.js
*
* Class: OpenLayers.Geometry.Surface
*/ */
OpenLayers.Geometry.Surface = OpenLayers.Class.create(); OpenLayers.Geometry.Surface = OpenLayers.Class.create();
OpenLayers.Geometry.Surface.prototype = OpenLayers.Geometry.Surface.prototype =
OpenLayers.Class.inherit(OpenLayers.Geometry, { OpenLayers.Class.inherit(OpenLayers.Geometry, {
/** /**
* @constructor * Constructor: OpenLayers.Geometry.Surface
* *
*/ */
initialize: function() { initialize: function() {
OpenLayers.Geometry.prototype.initialize.apply(this, arguments); OpenLayers.Geometry.prototype.initialize.apply(this, arguments);
}, },
/** @final @type String */ /** @final @type String */
CLASS_NAME: "OpenLayers.Geometry.Surface" CLASS_NAME: "OpenLayers.Geometry.Surface"
}); });
+34 -21
View File
@@ -4,11 +4,10 @@
/** /**
* Class: OpenLayers.Handler
* Base class to construct a higher-level handler for event sequences. * Base class to construct a higher-level handler for event sequences.
* Handlers are created by controls, which ultimately have the responsibility * Handlers are created by controls, which ultimately have the responsibility
* of making changes to the map. * of making changes to the map.
*
* @class
*/ */
OpenLayers.Handler = OpenLayers.Class.create(); OpenLayers.Handler = OpenLayers.Class.create();
@@ -19,42 +18,44 @@ OpenLayers.Handler.MOD_ALT = 4;
OpenLayers.Handler.prototype = { OpenLayers.Handler.prototype = {
/** /**
* @type String * Property: id
* @private * *Private*. {String}
*/ */
id: null, id: null,
/** /**
* The control that initialized this handler. * Property: control
* @type OpenLayers.Control * *Private*. {<OpenLayers.Control>}. The control that initialized this
* @private * handler.
*/ */
control: null, control: null,
/** /**
* @type OpenLayers.Map * Property: map
* @private * *Private*. {<OpenLayers.Map>}
*/ */
map: null, map: null,
/** /**
* @type integer * Property: keyMask
* {Integer}
*/ */
// keyMask: OpenLayers.Handler.MOD_NONE,
keyMask: null, keyMask: null,
/** /**
* @type Boolean * Property: active
* @private * *Private*. {Boolean}
*/ */
active: false, active: false,
/** /**
* @constructor * Constructor: OpenLayers.Handler
* Construct a handler.
* *
* @param {OpenLayers.Control} control * Parameters:
* @param {Object} callbacks A hash of callback functions * control - {<OpenLayers.Control>}
* @param {Object} options * callbacks - {Object} A hash of callback functions
* options - {Object}
*/ */
initialize: function(control, callbacks, options) { initialize: function(control, callbacks, options) {
OpenLayers.Util.extend(this, options); OpenLayers.Util.extend(this, options);
@@ -69,10 +70,16 @@ OpenLayers.Handler.prototype = {
this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_"); this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_");
}, },
/**
* Method: setMap
*/
setMap: function (map) { setMap: function (map) {
this.map = map; this.map = map;
}, },
/**
* Method: checkModifiers
*/
checkModifiers: function (evt) { checkModifiers: function (evt) {
if(this.keyMask == null) { if(this.keyMask == null) {
return true; return true;
@@ -89,9 +96,11 @@ OpenLayers.Handler.prototype = {
}, },
/** /**
* Method: activate
* Turn on the handler. Returns false if the handler was already active. * Turn on the handler. Returns false if the handler was already active.
* *
* @type {Boolean} * Return:
* {Boolean}
*/ */
activate: function() { activate: function() {
if(this.active) { if(this.active) {
@@ -109,9 +118,10 @@ OpenLayers.Handler.prototype = {
}, },
/** /**
* Method: deactivate
* Turn off the handler. Returns false if the handler was already inactive. * Turn off the handler. Returns false if the handler was already inactive.
* *
* @type {Boolean} * Return: {Boolean}
*/ */
deactivate: function() { deactivate: function() {
if(!this.active) { if(!this.active) {
@@ -129,6 +139,7 @@ OpenLayers.Handler.prototype = {
}, },
/** /**
* Method: callback
* trigger the control's named callback with the given arguments * trigger the control's named callback with the given arguments
*/ */
callback: function (name, args) { callback: function (name, args) {
@@ -138,6 +149,7 @@ OpenLayers.Handler.prototype = {
}, },
/** /**
* Method: register
* register an event on the map * register an event on the map
*/ */
register: function (name, method) { register: function (name, method) {
@@ -146,6 +158,7 @@ OpenLayers.Handler.prototype = {
}, },
/** /**
* Method: unregister
* unregister an event from the map * unregister an event from the map
*/ */
unregister: function (name, method) { unregister: function (name, method) {
@@ -153,7 +166,7 @@ OpenLayers.Handler.prototype = {
}, },
/** /**
* * Method: destroy
*/ */
destroy: function () { destroy: function () {
// eliminate circular references // eliminate circular references
+33 -12
View File
@@ -3,28 +3,34 @@
* for the full text of the license. */ * for the full text of the license. */
/** /**
* @requires OpenLayers/Handler.js
* @requires OpenLayers/Handler/Drag.js
*
* Class: OpenLayers.Handler.Box
* Handler for dragging a rectangle across the map. Box is displayed * Handler for dragging a rectangle across the map. Box is displayed
* on mouse down, moves on mouse move, and is finished on mouse up. * on mouse down, moves on mouse move, and is finished on mouse up.
* *
* @class * Inherits from:
* @requires OpenLayers/Handler.js * - <OpenLayers.Handler>
*/ */
OpenLayers.Handler.Box = OpenLayers.Class.create(); OpenLayers.Handler.Box = OpenLayers.Class.create();
OpenLayers.Handler.Box.prototype = OpenLayers.Class.inherit( OpenLayers.Handler, { OpenLayers.Handler.Box.prototype = OpenLayers.Class.inherit( OpenLayers.Handler, {
/** /**
* @type OpenLayers.Handler.Drag * Property: dragHandler
*/ * {<OpenLayers.Handler.Drag>}
dragHandler: null, */
dragHandler: null,
/** /**
* @constructor * Constructor: OpenLayers.Handler.Box
* *
* @param {OpenLayers.Control} control * Parameters:
* @param {Object} callbacks An object containing a single function to be * control - {<OpenLayers.Control>}
* callbacks - {Object} An object containing a single function to be
* called when the drag operation is finished. * called when the drag operation is finished.
* The callback should expect to recieve a single * The callback should expect to recieve a single
* argument, the point geometry. * argument, the point geometry.
* @param {Object} options * options - {Object}
*/ */
initialize: function(control, callbacks, options) { initialize: function(control, callbacks, options) {
OpenLayers.Handler.prototype.initialize.apply(this, arguments); OpenLayers.Handler.prototype.initialize.apply(this, arguments);
@@ -38,6 +44,9 @@ OpenLayers.Handler.Box.prototype = OpenLayers.Class.inherit( OpenLayers.Handler,
this, callbacks, {keyMask: this.keyMask}); this, callbacks, {keyMask: this.keyMask});
}, },
/**
* Method: setMap
*/
setMap: function (map) { setMap: function (map) {
OpenLayers.Handler.prototype.setMap.apply(this, arguments); OpenLayers.Handler.prototype.setMap.apply(this, arguments);
if (this.dragHandler) { if (this.dragHandler) {
@@ -46,7 +55,10 @@ OpenLayers.Handler.Box.prototype = OpenLayers.Class.inherit( OpenLayers.Handler,
}, },
/** /**
* @param {Event} evt * Method: startBox
*
* Parameters:
* evt - {Event}
*/ */
startBox: function (xy) { startBox: function (xy) {
this.zoomBox = OpenLayers.Util.createDiv('zoomBox', this.zoomBox = OpenLayers.Util.createDiv('zoomBox',
@@ -67,6 +79,7 @@ OpenLayers.Handler.Box.prototype = OpenLayers.Class.inherit( OpenLayers.Handler,
}, },
/** /**
* Method: moveBox
*/ */
moveBox: function (xy) { moveBox: function (xy) {
var deltaX = Math.abs(this.dragHandler.start.x - xy.x); var deltaX = Math.abs(this.dragHandler.start.x - xy.x);
@@ -82,6 +95,7 @@ OpenLayers.Handler.Box.prototype = OpenLayers.Class.inherit( OpenLayers.Handler,
}, },
/** /**
* Method: endBox
*/ */
endBox: function(end) { endBox: function(end) {
var result; var result;
@@ -105,6 +119,7 @@ OpenLayers.Handler.Box.prototype = OpenLayers.Class.inherit( OpenLayers.Handler,
}, },
/** /**
* Method: removeBox
* Remove the zoombox from the screen and nullify our reference to it. * Remove the zoombox from the screen and nullify our reference to it.
*/ */
removeBox: function() { removeBox: function() {
@@ -112,6 +127,9 @@ OpenLayers.Handler.Box.prototype = OpenLayers.Class.inherit( OpenLayers.Handler,
this.zoomBox = null; this.zoomBox = null;
}, },
/**
* Method: activate
*/
activate: function () { activate: function () {
if (OpenLayers.Handler.prototype.activate.apply(this, arguments)) { if (OpenLayers.Handler.prototype.activate.apply(this, arguments)) {
this.dragHandler.activate(); this.dragHandler.activate();
@@ -121,6 +139,9 @@ OpenLayers.Handler.Box.prototype = OpenLayers.Class.inherit( OpenLayers.Handler,
} }
}, },
/**
* Method: deactivate
*/
deactivate: function () { deactivate: function () {
if (OpenLayers.Handler.prototype.deactivate.apply(this, arguments)) { if (OpenLayers.Handler.prototype.deactivate.apply(this, arguments)) {
this.dragHandler.deactivate(); this.dragHandler.deactivate();
+62 -38
View File
@@ -3,54 +3,62 @@
* for the full text of the license. */ * for the full text of the license. */
/** /**
* Handler for dragging a rectangle across the map. Drag is displayed
* on mouse down, moves on mouse move, and is finished on mouse up.
*
* @class
* @requires OpenLayers/Handler.js * @requires OpenLayers/Handler.js
* @requires OpenLayers/Events.js * @requires OpenLayers/Events.js
*
* Class: OpenLayers.Handler.Drag
*/ */
OpenLayers.Handler.Drag = OpenLayers.Class.create(); OpenLayers.Handler.Drag = OpenLayers.Class.create();
OpenLayers.Handler.Drag.prototype = OpenLayers.Class.inherit( OpenLayers.Handler, { OpenLayers.Handler.Drag.prototype = OpenLayers.Class.inherit( OpenLayers.Handler, {
/** /**
* When a mousedown event is received, we want to record it, but not set * Property: started
* 'dragging' until the mouse moves after starting. * {Boolean} When a mousedown event is received, we want to record it, but
* * not set 'dragging' until the mouse moves after starting.
* @type Boolean
**/ **/
started: false, started: false,
/** @type Boolean **/ /**
dragging: false, * Property: dragging
* {Boolean}
*/
dragging: false,
/** @type OpenLayers.Pixel **/ /**
start: null, * Property: start
* {<OpenLayers.Pixel>}
*/
start: null,
/** /**
* @type Function * Property: oldOnselectstart
* @private * *Private*. {Function}
*/ */
oldOnselectstart: null, oldOnselectstart: null,
/** /**
* @constructor * Constructor: OpenLayers.Handler.Drag
* * Returns OpenLayers.Handler.Drag
* @param {OpenLayers.Control} control *
* @param {Object} callbacks An object containing a single function to be * Parameters:
* control - {<OpenLayers.Control>}
* callbacks - {Object} An object containing a single function to be
* called when the drag operation is finished. * called when the drag operation is finished.
* The callback should expect to recieve a single * The callback should expect to recieve a single
* argument, the point geometry. * argument, the point geometry.
* @param {Object} options * options - {Object}
*/ */
initialize: function(control, callbacks, options) { initialize: function(control, callbacks, options) {
OpenLayers.Handler.prototype.initialize.apply(this, arguments); OpenLayers.Handler.prototype.initialize.apply(this, arguments);
}, },
/** /**
* Method: mousedown
* Handle mousedown events * Handle mousedown events
* @param {Event} evt *
* @type Boolean * Parameters:
* @return Should the event propagate * evt - {Event}
*
* Return: {Boolean} Should the event propagate
*/ */
mousedown: function (evt) { mousedown: function (evt) {
if (this.checkModifiers(evt) && OpenLayers.Event.isLeftClick(evt)) { if (this.checkModifiers(evt) && OpenLayers.Event.isLeftClick(evt)) {
@@ -67,10 +75,13 @@ OpenLayers.Handler.Drag.prototype = OpenLayers.Class.inherit( OpenLayers.Handler
}, },
/** /**
* Method: mousemove
* Handle mousemove events * Handle mousemove events
* @param {Event} evt *
* @type Boolean * Parameters:
* @return Should the event propagate * evt - {Event}
*
* Return: {Boolean} Should the event propagate
*/ */
mousemove: function (evt) { mousemove: function (evt) {
if (this.started) { if (this.started) {
@@ -85,10 +96,13 @@ OpenLayers.Handler.Drag.prototype = OpenLayers.Class.inherit( OpenLayers.Handler
}, },
/** /**
* Method: mouseup
* Handle mouseup events * Handle mouseup events
* @param {Event} evt *
* @type Boolean * Parameters:
* @return Should the event propagate * evt - {Event}
*
* Return: {Boolean} Should the event propagate
*/ */
mouseup: function (evt) { mouseup: function (evt) {
if (this.started) { if (this.started) {
@@ -102,10 +116,13 @@ OpenLayers.Handler.Drag.prototype = OpenLayers.Class.inherit( OpenLayers.Handler
}, },
/** /**
* Method: mouseout
* Handle mouseout events * Handle mouseout events
* @param {Event} evt *
* @type Boolean * Parameters:
* @return Should the event propagate * evt - {Event}
*
* Return: {Boolean} Should the event propagate
*/ */
mouseout: function (evt) { mouseout: function (evt) {
if (this.started && OpenLayers.Util.mouseLeft(evt, this.map.div)) { if (this.started && OpenLayers.Util.mouseLeft(evt, this.map.div)) {
@@ -122,12 +139,15 @@ OpenLayers.Handler.Drag.prototype = OpenLayers.Class.inherit( OpenLayers.Handler
}, },
/** /**
* Method: click
* The drag handler captures the click event. If something else registers * The drag handler captures the click event. If something else registers
* for clicks on the same element, its listener will not be called after a * for clicks on the same element, its listener will not be called after a
* drag. * drag.
* @param {Event} evt *
* @type Boolean * Parameters:
* @return Should the event propagate * evt - {Event}
*
* Return: {Boolean} Should the event propagate
*/ */
click: function (evt) { click: function (evt) {
// throw away the first left click event that happens after a mouse up // throw away the first left click event that happens after a mouse up
@@ -140,9 +160,11 @@ OpenLayers.Handler.Drag.prototype = OpenLayers.Class.inherit( OpenLayers.Handler
}, },
/** /**
* Method: activate
* Activate the handler. * Activate the handler.
* @type Boolean *
* @return Was activation successful. Returns false if already active. * Return: {Boolean} Was activation successful. Returns false if already
* active.
*/ */
activate: function() { activate: function() {
if(OpenLayers.Handler.prototype.activate.apply(this, arguments)) { if(OpenLayers.Handler.prototype.activate.apply(this, arguments)) {
@@ -154,9 +176,11 @@ OpenLayers.Handler.Drag.prototype = OpenLayers.Class.inherit( OpenLayers.Handler
}, },
/** /**
* Method: deactivate
* Deactivate the handler. * Deactivate the handler.
* @type Boolean *
* @return Was deactivation successful. Returns false if not already active. * Return: {Boolean} Was deactivation successful. Returns false if already
* active.
*/ */
deactivate: function() { deactivate: function() {
if(OpenLayers.Handler.prototype.deactivate.apply(this, arguments)) { if(OpenLayers.Handler.prototype.deactivate.apply(this, arguments)) {
+37 -20
View File
@@ -4,37 +4,40 @@
/** /**
* @requires OpenLayers/Handler.js
*
* Class: OpenLayers.Handler.Feature
* Handler to respond to mouse events related to a drawn feature. * Handler to respond to mouse events related to a drawn feature.
* Callbacks will be called for over, move, out, up, and down (corresponding * Callbacks will be called for over, move, out, up, and down (corresponding
* to the equivalent mouse events). * to the equivalent mouse events).
*
* @class
* @requires OpenLayers/Handler.js
*/ */
OpenLayers.Handler.Feature = OpenLayers.Class.create(); OpenLayers.Handler.Feature = OpenLayers.Class.create();
OpenLayers.Handler.Feature.prototype = OpenLayers.Handler.Feature.prototype =
OpenLayers.Class.inherit(OpenLayers.Handler, { OpenLayers.Class.inherit(OpenLayers.Handler, {
/** /**
* @type {Int} * Property: layerIndex
* {Int}
*/ */
layerIndex: null, layerIndex: null,
/** /**
* @type {OpenLayers.Feature.Vector} * Property: feature
* {<OpenLayers.Feature.Vector>}
*/ */
feature: null, feature: null,
/** /**
* @constructor * Constructor: OpenLayers.Handler.Feature
* *
* @param {OpenLayers.Control} control * Parameters:
* @param {Array} layers List of OpenLayers.Layer.Vector * control - {<OpenLayers.Control>}
* @param {Array} callbacks An object with a 'over' property whos value is * layers - {Array} List of OpenLayers.Layer.Vector
* callbacks - {Array} An object with a 'over' property whos value is
* a function to be called when the mouse is over * a function to be called when the mouse is over
* a feature. The callback should expect to recieve * a feature. The callback should expect to recieve
* a single argument, the feature. * a single argument, the feature.
* @param {Object} options * options - {Object}
*/ */
initialize: function(control, layer, callbacks, options) { initialize: function(control, layer, callbacks, options) {
OpenLayers.Handler.prototype.initialize.apply(this, [control, callbacks, options]); OpenLayers.Handler.prototype.initialize.apply(this, [control, callbacks, options]);
@@ -42,9 +45,11 @@ OpenLayers.Handler.Feature.prototype =
}, },
/** /**
* Method: mousedown
* Handle mouse down. Call the "down" callback if down on a feature. * Handle mouse down. Call the "down" callback if down on a feature.
* *
* @param {Event} evt * Parameters:
* evt - {Event}
*/ */
mousedown: function(evt) { mousedown: function(evt) {
var selected = this.select('down', evt); var selected = this.select('down', evt);
@@ -52,11 +57,13 @@ OpenLayers.Handler.Feature.prototype =
}, },
/** /**
* Method: mousemove
* Handle mouse moves. Call the "move" callback if moving over a feature. * Handle mouse moves. Call the "move" callback if moving over a feature.
* Call the "over" callback if moving over a feature for the first time. * Call the "over" callback if moving over a feature for the first time.
* Call the "out" callback if moving off of a feature. * Call the "out" callback if moving off of a feature.
* *
* @param {Event} evt * Parameters:
* evt - {Event}
*/ */
mousemove: function(evt) { mousemove: function(evt) {
this.select('move', evt); this.select('move', evt);
@@ -64,9 +71,11 @@ OpenLayers.Handler.Feature.prototype =
}, },
/** /**
* Handle mouse moves. Call the "up" callback if up on a feature. * Method: mouseup
* Handle mouse up. Call the "up" callback if up on a feature.
* *
* @param {Event} evt * Parameters:
* evt - {Event}
*/ */
mouseup: function(evt) { mouseup: function(evt) {
var selected = this.select('up', evt); var selected = this.select('up', evt);
@@ -74,11 +83,13 @@ OpenLayers.Handler.Feature.prototype =
}, },
/** /**
* Method: dblclick
* Capture double-clicks. Let the event continue propagating if the * Capture double-clicks. Let the event continue propagating if the
* double-click doesn't hit a feature. Otherwise call the dblclick * double-click doesn't hit a feature. Otherwise call the dblclick
* callback. * callback.
* *
* @param {Event} evt * Parameters:
* evt - {Event}
*/ */
dblclick: function(evt) { dblclick: function(evt) {
var selected = this.select('dblclick', evt); var selected = this.select('dblclick', evt);
@@ -86,10 +97,14 @@ OpenLayers.Handler.Feature.prototype =
}, },
/** /**
* Method: select
* Trigger the appropriate callback if a feature is under the mouse. * Trigger the appropriate callback if a feature is under the mouse.
* *
* @param {String} type Callback key * Parameters:
* @type {Boolean} A feature was selected * type - {String} Callback key
*
* Return:
* {Boolean} A feature was selected
*/ */
select: function(type, evt) { select: function(type, evt) {
var feature = this.layer.getFeatureFromEvent(evt); var feature = this.layer.getFeatureFromEvent(evt);
@@ -118,9 +133,10 @@ OpenLayers.Handler.Feature.prototype =
}, },
/** /**
* Method: activate
* Turn on the handler. Returns false if the handler was already active. * Turn on the handler. Returns false if the handler was already active.
* *
* @type {Boolean} * Return: {Boolean}
*/ */
activate: function() { activate: function() {
if(OpenLayers.Handler.prototype.activate.apply(this, arguments)) { if(OpenLayers.Handler.prototype.activate.apply(this, arguments)) {
@@ -133,9 +149,10 @@ OpenLayers.Handler.Feature.prototype =
}, },
/** /**
* Turn onf the handler. Returns false if the handler was already active. * Method: activate
* Turn of the handler. Returns false if the handler was already active.
* *
* @type {Boolean} * Returns: {Boolean}
*/ */
deactivate: function() { deactivate: function() {
if(OpenLayers.Handler.prototype.deactivate.apply(this, arguments)) { if(OpenLayers.Handler.prototype.deactivate.apply(this, arguments)) {
+25 -8
View File
@@ -3,12 +3,13 @@
* for the full text of the license. */ * for the full text of the license. */
/** /**
* Handler for dragging a rectangle across the map. Keyboard is displayed
* on mouse down, moves on mouse move, and is finished on mouse up.
*
* @class
* @requires OpenLayers/Handler.js * @requires OpenLayers/Handler.js
* @requires OpenLayers/Events.js * @requires OpenLayers/Events.js
*
* Class: OpenLayers.handler.Keyboard
*
* Inherits from:
* - <OpenLayers.Handler>
*/ */
OpenLayers.Handler.Keyboard = OpenLayers.Class.create(); OpenLayers.Handler.Keyboard = OpenLayers.Class.create();
OpenLayers.Handler.Keyboard.prototype = OpenLayers.Class.inherit( OpenLayers.Handler, { OpenLayers.Handler.Keyboard.prototype = OpenLayers.Class.inherit( OpenLayers.Handler, {
@@ -18,14 +19,21 @@ OpenLayers.Handler.Keyboard.prototype = OpenLayers.Class.inherit( OpenLayers.Han
/* supported named callbacks are: keyup, keydown, keypress */ /* supported named callbacks are: keyup, keydown, keypress */
/** constant */ /**
* Constant: KEY_EVENTS
* keydown, keypress, keyup
*/
KEY_EVENTS: ["keydown", "keypress", "keyup"], KEY_EVENTS: ["keydown", "keypress", "keyup"],
/** @type Function /**
* @private * Property: eventListener
* *Private*. {Function}
*/ */
eventListener: null, eventListener: null,
/**
* Constructor: OpenLayers.Handler.Keyboard
*/
initialize: function () { initialize: function () {
OpenLayers.Handler.prototype.initialize.apply(this, arguments); OpenLayers.Handler.prototype.initialize.apply(this, arguments);
// cache the bound event listener method so it can be unobserved later // cache the bound event listener method so it can be unobserved later
@@ -33,7 +41,7 @@ OpenLayers.Handler.Keyboard.prototype = OpenLayers.Class.inherit( OpenLayers.Han
}, },
/** /**
* * Method: destroy
*/ */
destroy: function() { destroy: function() {
this.deactivate(); this.deactivate();
@@ -41,6 +49,9 @@ OpenLayers.Handler.Keyboard.prototype = OpenLayers.Class.inherit( OpenLayers.Han
OpenLayers.Control.prototype.destroy.apply(this, arguments); OpenLayers.Control.prototype.destroy.apply(this, arguments);
}, },
/**
* Method: activate
*/
activate: function() { activate: function() {
if (OpenLayers.Handler.prototype.activate.apply(this, arguments)) { if (OpenLayers.Handler.prototype.activate.apply(this, arguments)) {
for (var i = 0; i < this.KEY_EVENTS.length; i++) { for (var i = 0; i < this.KEY_EVENTS.length; i++) {
@@ -53,6 +64,9 @@ OpenLayers.Handler.Keyboard.prototype = OpenLayers.Class.inherit( OpenLayers.Han
} }
}, },
/**
* Method: deactivate
*/
deactivate: function() { deactivate: function() {
if (OpenLayers.Handler.prototype.deactivate.apply(this, arguments)) { if (OpenLayers.Handler.prototype.deactivate.apply(this, arguments)) {
for (var i = 0; i < this.KEY_EVENTS.length; i++) { for (var i = 0; i < this.KEY_EVENTS.length; i++) {
@@ -65,6 +79,9 @@ OpenLayers.Handler.Keyboard.prototype = OpenLayers.Class.inherit( OpenLayers.Han
} }
}, },
/**
* Method: handleKeyEvent
*/
handleKeyEvent: function (evt) { handleKeyEvent: function (evt) {
if (this.checkModifiers(evt)) { if (this.checkModifiers(evt)) {
this.callback(evt.type, [evt.charCode || evt.keyCode]); this.callback(evt.type, [evt.charCode || evt.keyCode]);
+42 -16
View File
@@ -3,33 +3,40 @@
* for the full text of the license. */ * for the full text of the license. */
/** /**
* @requires OpenLayers/Handler.js
*
* Class: OpenLayers.Handler.MouseWheel
* Handler for wheel up/down events. * Handler for wheel up/down events.
* *
* @class * Inherits from:
* @requires OpenLayers/Handler.js * - <OpenLayers.Handler>
*/ */
OpenLayers.Handler.MouseWheel = OpenLayers.Class.create(); OpenLayers.Handler.MouseWheel = OpenLayers.Class.create();
OpenLayers.Handler.MouseWheel.prototype = OpenLayers.Class.inherit( OpenLayers.Handler, { OpenLayers.Handler.MouseWheel.prototype = OpenLayers.Class.inherit( OpenLayers.Handler, {
/** @type function **/ /**
* Property: wheelListener
* {function}
*/
wheelListener: null, wheelListener: null,
/** @type OpenLayers.Pixel /**
* @private * Property: mousePosition
* * *Private*. {<OpenLayers.Pixel>} mousePosition is necessary because
* mousePosition is necessary because evt.clientX/Y is buggy in Moz on * evt.clientX/Y is buggy in Moz on wheel events, so we cache and use the
* wheel events, so we cache and use the value from the last mousemove. * value from the last mousemove.
**/ */
mousePosition: null, mousePosition: null,
/** /**
* @constructor * Constructor: OpenLayers.Handler.MouseWheel
* *
* @param {OpenLayers.Control} control * Parameters:
* @param {Object} callbacks An object containing a single function to be * control - {<OpenLayers.Control>}
* callbacks - {Object} An object containing a single function to be
* called when the drag operation is finished. * called when the drag operation is finished.
* The callback should expect to recieve a single * The callback should expect to recieve a single
* argument, the point geometry. * argument, the point geometry.
* @param {Object} options * options - {Object}
*/ */
initialize: function(control, callbacks, options) { initialize: function(control, callbacks, options) {
OpenLayers.Handler.prototype.initialize.apply(this, arguments); OpenLayers.Handler.prototype.initialize.apply(this, arguments);
@@ -37,7 +44,7 @@ OpenLayers.Handler.MouseWheel.prototype = OpenLayers.Class.inherit( OpenLayers.H
}, },
/** /**
* * Method: destroy
*/ */
destroy: function() { destroy: function() {
this.deactivate(); this.deactivate();
@@ -49,9 +56,12 @@ OpenLayers.Handler.MouseWheel.prototype = OpenLayers.Class.inherit( OpenLayers.H
* Mouse ScrollWheel code thanks to http://adomas.org/javascript-mouse-wheel/ * Mouse ScrollWheel code thanks to http://adomas.org/javascript-mouse-wheel/
*/ */
/** Catch the wheel event and handle it xbrowserly /**
* Method: onWheelEvent
* Catch the wheel event and handle it xbrowserly
* *
* @param {Event} e * Parameters:
* e - {Event}
*/ */
onWheelEvent: function(e){ onWheelEvent: function(e){
// first check keyboard modifiers // first check keyboard modifiers
@@ -98,10 +108,23 @@ OpenLayers.Handler.MouseWheel.prototype = OpenLayers.Class.inherit( OpenLayers.H
} }
}, },
/**
* Method: mousemove
* Update the stored mousePosition on every move.
*
* Parameters:
* evt - {Event} The browser event
*
* Return:
* {Boolean} Allow event propagation
*/
mousemove: function (evt) { mousemove: function (evt) {
this.mousePosition = evt.xy; this.mousePosition = evt.xy;
}, },
/**
* Method: activate
*/
activate: function (evt) { activate: function (evt) {
if (OpenLayers.Handler.prototype.activate.apply(this, arguments)) { if (OpenLayers.Handler.prototype.activate.apply(this, arguments)) {
//register mousewheel events specifically on the window and document //register mousewheel events specifically on the window and document
@@ -115,6 +138,9 @@ OpenLayers.Handler.MouseWheel.prototype = OpenLayers.Class.inherit( OpenLayers.H
} }
}, },
/**
* Method: deactivate
*/
deactivate: function (evt) { deactivate: function (evt) {
if (OpenLayers.Handler.prototype.deactivate.apply(this, arguments)) { if (OpenLayers.Handler.prototype.deactivate.apply(this, arguments)) {
// unregister mousewheel events specifically on the window and document // unregister mousewheel events specifically on the window and document
+83 -55
View File
@@ -4,66 +4,69 @@
/** /**
* Handler to draw a path on the map. Path is displayed on mouse down,
* moves on mouse move, and is finished on mouse up.
*
* @class
* @requires OpenLayers/Handler/Point.js * @requires OpenLayers/Handler/Point.js
* @requires OpenLayers/Geometry/Point.js * @requires OpenLayers/Geometry/Point.js
* @requires OpenLayers/Geometry/LineString.js * @requires OpenLayers/Geometry/LineString.js
*
* Class: OpenLayers.Handler.Path
* Handler to draw a path on the map. Path is displayed on mouse down,
* moves on mouse move, and is finished on mouse up.
*
* Inherits from:
* - <OpenLayers.Handler.Point>
*/ */
OpenLayers.Handler.Path = OpenLayers.Class.create(); OpenLayers.Handler.Path = OpenLayers.Class.create();
OpenLayers.Handler.Path.prototype = OpenLayers.Handler.Path.prototype =
OpenLayers.Class.inherit(OpenLayers.Handler.Point, { OpenLayers.Class.inherit(OpenLayers.Handler.Point, {
/** /**
* @type OpenLayers.Feature.Vector * Property: line
* @private * *Private*. {<OpenLayers.Feature.Vector>}
*/ */
line: null, line: null,
/** /**
* In freehand mode, the handler starts the path on mouse down, adds a point * Property: freehand
* for every mouse move, and finishes the path on mouse up. Outside of * {Boolean} In freehand mode, the handler starts the path on mouse down,
* freehand mode, a point is added to the path on every mouse click and * adds a point for every mouse move, and finishes the path on mouse up.
* double-click finishes the path. * Outside of freehand mode, a point is added to the path on every mouse
* * click and double-click finishes the path.
* @type Boolean
*/ */
freehand: false, freehand: false,
/** /**
* If set, freehandToggle is checked on mouse events and will set the * Property: freehandToggle
* freehand mode to the opposite of this.freehand. To disallow toggling * {String} If set, freehandToggle is checked on mouse events and will set
* between freehand and non-freehand mode, set freehandToggle to null. * the freehand mode to the opposite of this.freehand. To disallow
* Acceptable toggle values are 'shiftKey', 'ctrlKey', and 'altKey'. * toggling between freehand and non-freehand mode, set freehandToggle to
* * null. Acceptable toggle values are 'shiftKey', 'ctrlKey', and 'altKey'.
* @type String
*/ */
freehandToggle: 'shiftKey', freehandToggle: 'shiftKey',
/** /**
* @constructor * Constructor: OpenLayers.Handler.Path
* Create a new path hander
* *
* @param {OpenLayers.Control} control * Parameters:
* @param {Array} callbacks An object with a 'done' property whos value is * control - {<OpenLayers.Control>}
* a function to be called when the path drawing is * callbacks - {Array} An object with a 'done' property whos value is a
* finished. The callback should expect to recieve a * function to be called when the path drawing is finished. The callback
* single argument, the line string geometry. * should expect to recieve a single argument, the line string geometry.
* If the callbacks object contains a 'point' * If the callbacks object contains a 'point' property, this function will
* property, this function will be sent each point * be sent each point as they are added. If the callbacks object contains
* as they are added. If the callbacks object contains * a 'cancel' property, this function will be called when the handler is
* a 'cancel' property, this function will be called when * deactivated while drawing. The cancel should expect to receive a
* the handler is deactivated while drawing. The cancel * geometry.
* should expect to receive a geometry. * options - {Object} An optional object with properties to be set on the
* @param {Object} options * handler
*/ */
initialize: function(control, callbacks, options) { initialize: function(control, callbacks, options) {
OpenLayers.Handler.Point.prototype.initialize.apply(this, arguments); OpenLayers.Handler.Point.prototype.initialize.apply(this, arguments);
}, },
/** /**
* Add temporary geometries * Method: createFeature
* *Private*. Add temporary geometries
*/ */
createFeature: function() { createFeature: function() {
this.line = new OpenLayers.Feature.Vector( this.line = new OpenLayers.Feature.Vector(
@@ -73,7 +76,8 @@ OpenLayers.Handler.Path.prototype =
}, },
/** /**
* Destroy temporary geometries * Method: destroyFeature
* *Private*. Destroy temporary geometries
*/ */
destroyFeature: function() { destroyFeature: function() {
this.line.destroy(); this.line.destroy();
@@ -81,7 +85,8 @@ OpenLayers.Handler.Path.prototype =
}, },
/** /**
* Add point to geometry. Send the point index to override * Method: addPoint
* *Private*. Add point to geometry. Send the point index to override
* the behavior of LinearRing that disregards adding duplicate points. * the behavior of LinearRing that disregards adding duplicate points.
*/ */
addPoint: function() { addPoint: function() {
@@ -91,9 +96,10 @@ OpenLayers.Handler.Path.prototype =
}, },
/** /**
* Determine whether to behanve in freehand mode or not. * Method: freehandMode
* *Private*. Determine whether to behave in freehand mode or not.
* *
* @type Boolean * Return: {Boolean}
*/ */
freehandMode: function(evt) { freehandMode: function(evt) {
return (this.freehandToggle && evt[this.freehandToggle]) ? return (this.freehandToggle && evt[this.freehandToggle]) ?
@@ -101,8 +107,8 @@ OpenLayers.Handler.Path.prototype =
}, },
/** /**
* Modify the existing geometry given the new point * Method: modifyFeature
* * *Private*. Modify the existing geometry given the new point
*/ */
modifyFeature: function() { modifyFeature: function() {
var index = this.line.geometry.components.length - 1; var index = this.line.geometry.components.length - 1;
@@ -111,7 +117,8 @@ OpenLayers.Handler.Path.prototype =
}, },
/** /**
* Render geometries on the temporary layer. * Method: drawFeature
* *Private*. Render geometries on the temporary layer.
*/ */
drawFeature: function() { drawFeature: function() {
this.layer.drawFeature(this.line, this.style); this.layer.drawFeature(this.line, this.style);
@@ -119,20 +126,25 @@ OpenLayers.Handler.Path.prototype =
}, },
/** /**
* Return a clone of the relevant geometry. * Method: geometryClone
* *Private*. Return a clone of the relevant geometry.
* *
* @type OpenLayers.Geometry.LineString * Return: {<OpenLayers.Geometry.LineString>}
*/ */
geometryClone: function() { geometryClone: function() {
return this.line.geometry.clone(); return this.line.geometry.clone();
}, },
/** /**
* Handle mouse down. Add a new point to the geometry and render it. * Method: mousedown
* Return determines whether to propagate the event on the map. * *Private*. Handle mouse down. Add a new point to the geometry and
* render it. Return determines whether to propagate the event on the map.
* *
* @param {Event} evt * Parameters:
* @type Boolean * evt - {Event} The browser event
*
* Return:
* {Boolean} Allow event propagation
*/ */
mousedown: function(evt) { mousedown: function(evt) {
// ignore double-clicks // ignore double-clicks
@@ -156,11 +168,15 @@ OpenLayers.Handler.Path.prototype =
}, },
/** /**
* Handle mouse move. Adjust the geometry and redraw. * Method: mousemove
* *Private*. Handle mouse move. Adjust the geometry and redraw.
* Return determines whether to propagate the event on the map. * Return determines whether to propagate the event on the map.
* *
* @param {Event} evt * Parameters:
* @type Boolean * evt - {Event} The browser event
*
* Return:
* {Boolean} Allow event propagation
*/ */
mousemove: function (evt) { mousemove: function (evt) {
if(this.drawing) { if(this.drawing) {
@@ -178,11 +194,15 @@ OpenLayers.Handler.Path.prototype =
}, },
/** /**
* Handle mouse up. Send the latest point in the geometry to the control. * Method: mouseup
* Return determines whether to propagate the event on the map. * *Private*. Handle mouse up. Send the latest point in the geometry to
* the control. Return determines whether to propagate the event on the map.
* *
* @param {Event} evt * Parameters:
* @type Boolean * evt - {Event} The browser event
*
* Return:
* {Boolean} Allow event propagation
*/ */
mouseup: function (evt) { mouseup: function (evt) {
this.mouseDown = false; this.mouseDown = false;
@@ -201,10 +221,15 @@ OpenLayers.Handler.Path.prototype =
}, },
/** /**
* Handle double-clicks. Finish the geometry and send it back * Method: dblclick
* *Private*. Handle double-clicks. Finish the geometry and send it back
* to the control. * to the control.
* *
* @param {Event} evt * Parameters:
* evt - {Event} The browser event
*
* Return:
* {Boolean} Allow event propagation
*/ */
dblclick: function(evt) { dblclick: function(evt) {
if(!this.freehandMode(evt)) { if(!this.freehandMode(evt)) {
@@ -215,6 +240,9 @@ OpenLayers.Handler.Path.prototype =
return false; return false;
}, },
/** @final @type String */ /**
* Constant: CLASS_NAME
* {String} Name of class.
*/
CLASS_NAME: "OpenLayers.Handler.Path" CLASS_NAME: "OpenLayers.Handler.Path"
}); });
+76 -38
View File
@@ -4,65 +4,73 @@
/** /**
* Handler to draw a point on the map. Point is displayed on mouse down,
* moves on mouse move, and is finished on mouse up.
*
* @class
* @requires OpenLayers/Handler.js * @requires OpenLayers/Handler.js
* @requires OpenLayers/Geometry/Point.js * @requires OpenLayers/Geometry/Point.js
*
* Class: OpenLayers.Handler.Point
* Handler to draw a point on the map. Point is displayed on mouse down,
* moves on mouse move, and is finished on mouse up. The handler triggers
* callbacks for 'done' and 'cancel'. Create a new instance with the
* <OpenLayers.Handler.Point> constructor.
*
* Inherits from:
* - <OpenLayers.Handler>
*/ */
OpenLayers.Handler.Point = OpenLayers.Class.create(); OpenLayers.Handler.Point = OpenLayers.Class.create();
OpenLayers.Handler.Point.prototype = OpenLayers.Handler.Point.prototype =
OpenLayers.Class.inherit(OpenLayers.Handler, { OpenLayers.Class.inherit(OpenLayers.Handler, {
/** /**
* @type OpenLayers.Feature.Vector * Property: point
* @private * {<OpenLayers.Feature.Vector>} The currently drawn point
*/ */
point: null, point: null,
/** /**
* @type OpenLayers.Layer.Vector * Property: layer
* @private * {<OpenLayers.Layer.Vector>} The temporary drawing layer
*/ */
layer: null, layer: null,
/** /**
* @type Boolean * Property: drawing
* @private * {Boolean} A point is being drawn
*/ */
drawing: false, drawing: false,
/** /**
* @type Boolean * Property: mouseDown
* @private * {Boolean} The mouse is down
*/ */
mouseDown: false, mouseDown: false,
/** /**
* @type OpenLayers.Pixel * Property: lastDown
* @private * {<OpenLayers.Pixel>} Location of the last mouse down
*/ */
lastDown: null, lastDown: null,
/** /**
* @type OpenLayers.Pixel * Property: lastUp
* @private * {<OpenLayers.Pixel>}
*/ */
lastUp: null, lastUp: null,
/** /**
* @constructor * Constructor: OpenLayers.Handler.Point
* Create a new point handler.
* *
* @param {OpenLayers.Control} control * Parameters:
* @param {Array} callbacks An object with a 'done' property whos value is * control - {<OpenLayers.Control>} The control that owns this handler
* a function to be called when the point drawing * callbacks - {Array} An object with a 'done' property whos value is a
* is finished. The callback should expect to * function to be called when the point drawing is finished.
* recieve a single argument, the point geometry. * The callback should expect to recieve a single argument,
* If the callbacks object contains a 'cancel' property, * the point geometry. If the callbacks object contains a
* this function will be called when the handler is deactivated * 'cancel' property, this function will be called when the
* while drawing. The cancel should expect to receive a geometry. * handler is deactivated while drawing. The cancel should
* @param {Object} options * expect to receive a geometry.
* options - {Object} An optional object with properties to be set on the
* handler
*/ */
initialize: function(control, callbacks, options) { initialize: function(control, callbacks, options) {
// TBD: deal with style // TBD: deal with style
@@ -72,6 +80,7 @@ OpenLayers.Handler.Point.prototype =
}, },
/** /**
* APIMethod: activate
* turn on the handler * turn on the handler
*/ */
activate: function() { activate: function() {
@@ -87,6 +96,7 @@ OpenLayers.Handler.Point.prototype =
}, },
/** /**
* Method: createFeature
* Add temporary features * Add temporary features
*/ */
createFeature: function() { createFeature: function() {
@@ -95,6 +105,7 @@ OpenLayers.Handler.Point.prototype =
}, },
/** /**
* APIMethod: deactivate
* turn off the handler * turn off the handler
*/ */
deactivate: function() { deactivate: function() {
@@ -111,6 +122,7 @@ OpenLayers.Handler.Point.prototype =
}, },
/** /**
* Method: destroyFeature
* Destroy the temporary geometries * Destroy the temporary geometries
*/ */
destroyFeature: function() { destroyFeature: function() {
@@ -118,6 +130,7 @@ OpenLayers.Handler.Point.prototype =
}, },
/** /**
* Method: finalize
* Finish the geometry and call the "done" callback. * Finish the geometry and call the "done" callback.
*/ */
finalize: function() { finalize: function() {
@@ -131,6 +144,7 @@ OpenLayers.Handler.Point.prototype =
}, },
/** /**
* APIMethod: cancel
* Finish the geometry and call the "cancel" callback. * Finish the geometry and call the "cancel" callback.
*/ */
cancel: function() { cancel: function() {
@@ -144,7 +158,14 @@ OpenLayers.Handler.Point.prototype =
}, },
/** /**
* Method: dblclick
* Handle double clicks. * Handle double clicks.
*
* Parameters:
* evt - {Event} The browser event
*
* Return:
* {Boolean} Allow event propagation
*/ */
dblclick: function(evt) { dblclick: function(evt) {
OpenLayers.Event.stop(evt); OpenLayers.Event.stop(evt);
@@ -152,6 +173,7 @@ OpenLayers.Handler.Point.prototype =
}, },
/** /**
* Method: drawFeature
* Render features on the temporary layer. * Render features on the temporary layer.
*/ */
drawFeature: function() { drawFeature: function() {
@@ -159,20 +181,25 @@ OpenLayers.Handler.Point.prototype =
}, },
/** /**
* Method: geometryClone
* Return a clone of the relevant geometry. * Return a clone of the relevant geometry.
* *
* @type OpenLayers.Geometry.Point * Return: {<OpenLayers.Geometry.Point>}
*/ */
geometryClone: function() { geometryClone: function() {
return this.point.geometry.clone(); return this.point.geometry.clone();
}, },
/** /**
* Handle mouse down. Add a new point to the geometry and render it. * Method: mousedown
* Handle mouse down. Adjust the geometry and redraw.
* Return determines whether to propagate the event on the map. * Return determines whether to propagate the event on the map.
* *
* @param {Event} evt * Parameters:
* @type Boolean * evt - {Event} The browser event
*
* Return:
* {Boolean} Allow event propagation
*/ */
mousedown: function(evt) { mousedown: function(evt) {
// check keyboard modifiers // check keyboard modifiers
@@ -196,13 +223,17 @@ OpenLayers.Handler.Point.prototype =
}, },
/** /**
* Method: mousemove
* Handle mouse move. Adjust the geometry and redraw. * Handle mouse move. Adjust the geometry and redraw.
* Return determines whether to propagate the event on the map. * Return determines whether to propagate the event on the map.
* *
* @param {Event} evt * Parameters:
* @type Boolean * evt - {Event} The browser event
*
* Return:
* {Boolean} Allow event propagation
*/ */
mousemove: function (evt) { mousemove: function (evt) {
if(this.drawing) { if(this.drawing) {
var lonlat = this.map.getLonLatFromPixel(evt.xy); var lonlat = this.map.getLonLatFromPixel(evt.xy);
this.point.geometry.x = lonlat.lon; this.point.geometry.x = lonlat.lon;
@@ -213,13 +244,17 @@ OpenLayers.Handler.Point.prototype =
}, },
/** /**
* Method: mouseup
* Handle mouse up. Send the latest point in the geometry to the control. * Handle mouse up. Send the latest point in the geometry to the control.
* Return determines whether to propagate the event on the map. * Return determines whether to propagate the event on the map.
* *
* @param {Event} evt * Parameters:
* @type Boolean * evt - {Event} The browser event
*
* Return:
* {Boolean} Allow event propagation
*/ */
mouseup: function (evt) { mouseup: function (evt) {
if(this.drawing) { if(this.drawing) {
this.finalize(); this.finalize();
return false; return false;
@@ -228,6 +263,9 @@ OpenLayers.Handler.Point.prototype =
} }
}, },
/** @final @type String */ /**
* Constant: CLASS_NAME
* {String} Name of class.
*/
CLASS_NAME: "OpenLayers.Handler.Point" CLASS_NAME: "OpenLayers.Handler.Point"
}); });
+26 -12
View File
@@ -4,28 +4,34 @@
/** /**
* Handler to draw a path on the map. Polygon is displayed on mouse down,
* moves on mouse move, and is finished on mouse up.
*
* @class
* @requires OpenLayers/Handler/Path.js * @requires OpenLayers/Handler/Path.js
* @requires OpenLayers/Geometry/Polygon.js * @requires OpenLayers/Geometry/Polygon.js
*
* Class: OpenLayers.Handler.Polygon
* Handler to draw a polygon on the map. Polygon is displayed on mouse down,
* moves on mouse move, and is finished on mouse up.
*
* Inherits from:
* - <OpenLayers.Handler.Path>
* - <OpenLayers.Handler>
*/ */
OpenLayers.Handler.Polygon = OpenLayers.Class.create(); OpenLayers.Handler.Polygon = OpenLayers.Class.create();
OpenLayers.Handler.Polygon.prototype = OpenLayers.Handler.Polygon.prototype =
OpenLayers.Class.inherit(OpenLayers.Handler.Path, { OpenLayers.Class.inherit(OpenLayers.Handler.Path, {
/** /**
* @type OpenLayers.Feature.Vector * Parameter: polygon
* @private * *Private*. {<OpenLayers.Feature.Vector>}
*/ */
polygon: null, polygon: null,
/** /**
* @constructor * Constructor: OpenLayers.Handler.Polygon
* Create a Polygon Handler.
* *
* @param {OpenLayers.Control} control * Parameters:
* @param {Array} callbacks An object with a 'done' property whos value is * control - {<OpenLayers.Control>}
* callbacks - {Array} An object with a 'done' property whos value is
* a function to be called when the path drawing is * a function to be called when the path drawing is
* finished. The callback should expect to recieve a * finished. The callback should expect to recieve a
* single argument, the polygon geometry. * single argument, the polygon geometry.
@@ -35,13 +41,14 @@ OpenLayers.Handler.Polygon.prototype =
* a 'cancel' property, this function will be called when * a 'cancel' property, this function will be called when
* the handler is deactivated while drawing. The cancel * the handler is deactivated while drawing. The cancel
* should expect to receive a geometry. * should expect to receive a geometry.
* @param {Object} options * options - {Object}
*/ */
initialize: function(control, callbacks, options) { initialize: function(control, callbacks, options) {
OpenLayers.Handler.Path.prototype.initialize.apply(this, arguments); OpenLayers.Handler.Path.prototype.initialize.apply(this, arguments);
}, },
/** /**
* Method: createFeature
* Add temporary geometries * Add temporary geometries
*/ */
createFeature: function() { createFeature: function() {
@@ -55,6 +62,7 @@ OpenLayers.Handler.Polygon.prototype =
}, },
/** /**
* Method: destroyFeature
* Destroy temporary geometries * Destroy temporary geometries
*/ */
destroyFeature: function() { destroyFeature: function() {
@@ -63,6 +71,7 @@ OpenLayers.Handler.Polygon.prototype =
}, },
/** /**
* Method: modifyFeature
* Modify the existing geometry given the new point * Modify the existing geometry given the new point
* *
*/ */
@@ -73,6 +82,7 @@ OpenLayers.Handler.Polygon.prototype =
}, },
/** /**
* Method: drawFeature
* Render geometries on the temporary layer. * Render geometries on the temporary layer.
*/ */
drawFeature: function() { drawFeature: function() {
@@ -81,19 +91,23 @@ OpenLayers.Handler.Polygon.prototype =
}, },
/** /**
* Method: geometryClone
* Return a clone of the relevant geometry. * Return a clone of the relevant geometry.
* *
* @type OpenLayers.Geometry.Polygon * Return:
* {<OpenLayers.Geometry.Polygon>}
*/ */
geometryClone: function() { geometryClone: function() {
return this.polygon.geometry.clone(); return this.polygon.geometry.clone();
}, },
/** /**
* Method: dblclick
* Handle double-clicks. Finish the geometry and send it back * Handle double-clicks. Finish the geometry and send it back
* to the control. * to the control.
* *
* @param {Event} evt * Parameters:
* evt - {Event}
*/ */
dblclick: function(evt) { dblclick: function(evt) {
if(!this.freehandMode(evt)) { if(!this.freehandMode(evt)) {
+76 -37
View File
@@ -4,38 +4,54 @@
/** /**
* @class * Class: OpenLayers.Icon
*/ */
OpenLayers.Icon = OpenLayers.Class.create(); OpenLayers.Icon = OpenLayers.Class.create();
OpenLayers.Icon.prototype = { OpenLayers.Icon.prototype = {
/** image url /**
* @type String */ * Property: url
url: null, * {String} image url
*/
/** @type OpenLayers.Size */ url: null,
size:null,
/** distance in pixels to offset the image when being rendered
* @type OpenLayers.Pixel */
offset: null,
/** Function to calculate the offset (based on the size)
* @type OpenLayers.Pixel */
calculateOffset: null,
/** @type DOMElement */
imageDiv: null,
/** @type OpenLayers.Pixel */
px: null,
/** /**
* @constructor * Property: size
* {<OpenLayers.Size>}
*/
size: null,
/**
* Property: offset
* {<OpenLayers.Pixel>} distance in pixels to offset the image when being rendered
*/
offset: null,
/**
* Property: calculateOffset
* {<OpenLayers.Pixel>} Function to calculate the offset (based on the size)
*/
calculateOffset: null,
/**
* Property: imageDiv
* {DOMElement}
*/
imageDiv: null,
/**
* Property: px
* {<OpenLayers.Pixel>}
*/
px: null,
/**
* Constructor: OpenLayers.Icon
* Creates an icon, which is an image tag in a div.
* *
* @param {String} url * url - {String}
* @param {OpenLayers.Size} size * size - {<OpenLayers.Size>}
* @param {Function} calculateOffset * calculateOffset - {Function}
*/ */
initialize: function(url, size, offset, calculateOffset) { initialize: function(url, size, offset, calculateOffset) {
this.url = url; this.url = url;
@@ -47,6 +63,10 @@ OpenLayers.Icon.prototype = {
this.imageDiv = OpenLayers.Util.createAlphaImageDiv(id); this.imageDiv = OpenLayers.Util.createAlphaImageDiv(id);
}, },
/**
* Method: destroy
* nullify references to prevent circular references and memory leaks
*/
destroy: function() { destroy: function() {
OpenLayers.Event.stopObservingElement(this.imageDiv.firstChild); OpenLayers.Event.stopObservingElement(this.imageDiv.firstChild);
this.imageDiv.innerHTML = ""; this.imageDiv.innerHTML = "";
@@ -54,8 +74,10 @@ OpenLayers.Icon.prototype = {
}, },
/** /**
* @returns A fresh copy of the icon. * Method: clone
* @type OpenLayers.Icon *
* Returns:
* {<OpenLayers.Icon>} A fresh copy of the icon.
*/ */
clone: function() { clone: function() {
return new OpenLayers.Icon(this.url, return new OpenLayers.Icon(this.url,
@@ -65,7 +87,9 @@ OpenLayers.Icon.prototype = {
}, },
/** /**
* @param {OpenLayers.Size} size * Method: setSize
*
* size - {<OpenLayers.Size>}
*/ */
setSize: function(size) { setSize: function(size) {
if (size != null) { if (size != null) {
@@ -75,10 +99,14 @@ OpenLayers.Icon.prototype = {
}, },
/** /**
* @param {OpenLayers.Pixel} px * Method: draw
* Move the div to the given pixel.
* *
* @return A new DOM Image of this icon set at the location passed-in * Parameters:
* @type DOMElement * px - {<OpenLayers.Pixel>}
*
* Returns:
* {DOMElement} A new DOM Image of this icon set at the location passed-in
*/ */
draw: function(px) { draw: function(px) {
OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv, OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv,
@@ -92,8 +120,12 @@ OpenLayers.Icon.prototype = {
}, },
/** Change the icon's opacity /**
* @param {float} opacity * Method: setOpacity
* Change the icon's opacity
*
* Parameters:
* opacity - {float}
*/ */
setOpacity: function(opacity) { setOpacity: function(opacity) {
OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv, null, null, null, OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv, null, null, null,
@@ -102,7 +134,11 @@ OpenLayers.Icon.prototype = {
}, },
/** /**
* @param {OpenLayers.Pixel} px * Method: moveTo
* move icon to passed in px.
*
* Parameters:
* px - {<OpenLayers.Pixel>}
*/ */
moveTo: function (px) { moveTo: function (px) {
//if no px passed in, use stored location //if no px passed in, use stored location
@@ -123,9 +159,12 @@ OpenLayers.Icon.prototype = {
} }
}, },
/** Hide or show the icon /**
* * Method: display
* @param {Boolean} display * Hide or show the icon
*
* Parameters:
* display - {Boolean}
*/ */
display: function(display) { display: function(display) {
this.imageDiv.style.display = (display) ? "" : "none"; this.imageDiv.style.display = (display) ? "" : "none";
+282 -166
View File
@@ -4,155 +4,211 @@
/** /**
* @class
* @requires OpenLayers/Map.js * @requires OpenLayers/Map.js
*
* Class: OpenLayers.Layer
*/ */
OpenLayers.Layer = OpenLayers.Class.create(); OpenLayers.Layer = OpenLayers.Class.create();
OpenLayers.Layer.prototype = { OpenLayers.Layer.prototype = {
/** @type String */ /**
* APIProperty: id
* {String}
*/
id: null, id: null,
/** @type String */ /**
* APIProperty: name
* {String}
*/
name: null, name: null,
/** @type DOMElement */ /**
* APIProperty: div
* {DOMElement}
*/
div: null, div: null,
/** supported application event types /**
* * Constant: EVENT_TYPES
* @type Array */ * {Array(String)} Supported application event types
EVENT_TYPES: [ */
"loadstart", "loadend", "loadcancel"], EVENT_TYPES: [ "loadstart", "loadend", "loadcancel"],
/** @type OpenLayers.Events */ /**
* APIProperty: events``
* {<OpenLayers.Events>}
*/
events: null, events: null,
/** This variable is set when the layer is added to the map, via the /**
* accessor function setMap() * APIProperty: map
* * {<OpenLayers.Map>} This variable is set when the layer is added to
* @type OpenLayers.Map */ * the map, via the accessor function setMap().
*/
map: null, map: null,
/** Whether or not the layer is a base layer. This should be set /**
* individually by all subclasses. * APIProperty: isBaseLayer
* Default is false * {Boolean} Whether or not the layer is a base layer. This should be set
* * individually by all subclasses.
* @type Boolean * Default is false
*/ */
isBaseLayer: false, isBaseLayer: false,
/** asserts whether or not the layer's images have an alpha channel /**
* * Property: alpha
* @type boolean */ * {Boolean} Whether or not the layer's images have an alpha channel
*/
alpha: false, alpha: false,
/** should the layer's name appear in the layer switcher? /**
* * APIProperty: displayInLayerSwitcher
* @type boolean */ * {Boolean} Should the layer's name appear in the layer switcher?
*/
displayInLayerSwitcher: true, displayInLayerSwitcher: true,
/** Whether or not the layer should be displayed in the map /**
* * APIProperty: visibility
* @type Boolean * {Boolean} Whether or not the layer should be displayed in the map
*/ */
visibility: true, visibility: true,
/** Whether or not the map's current resolution is within this layer's /**
* min/max range -- this is set in map's setCenter() whenever zoom * APIProperty: inRange
* changes * {Boolean} Whether or not the map's current resolution is within this
* * layer's min/max range -- this is set in map's setCenter()
* @type Boolean * whenever zoom changes.
*/ */
inRange: false, inRange: false,
/** /**
* For layers that use Tile.Image, the image size is cached here. For * Propery: imageSize
* layers without a gutter, the image size is equal to the tile size. * {<OpenLayers.Size>} For layers with a gutter, the image is larger than
* For layers with a gutter, the image is larger than the tile by twice * the tile by twice the gutter in each dimension.
* the gutter in each dimension.
*
* @type OpenLayers.Size
* @private
*/ */
imageSize: null, imageSize: null,
/** /**
* For layers that use Tile.Image, the image offset is cached here. * Property: imageOffset
* Layers without a gutter have zero offset. For layers with a gutter, * {<OpenLayers.Pixel>} For layers with a gutter, the image offset
* the image offset represents displacement due to the gutter. * represents displacement due to the gutter.
*
* @type OpenLayers.Pixel
* @private
*/ */
imageOffset: null, imageOffset: null,
// OPTIONS // OPTIONS
/** @type Array */ /**
* Property: options
* {Object}
*/
options: null, options: null,
/** Determines the width (in pixels) of the gutter around image tiles /**
* to ignore. By setting this property to a non-zero value, images * Property: gutter
* will be requested that are wider and taller than the tile size by * {Integer} Determines the width (in pixels) of the gutter around image
* a value of 2 x gutter. This allows artifacts of rendering at tile * tiles to ignore. By setting this property to a non-zero
* edges to be ignored. Set a gutter value that is equal to half the size * value, images will be requested that are wider and taller
* of the widest symbol that needs to be displayed. Defaults to zero. * than the tile size by a value of 2 x gutter. This allows
* Non-tiled layers always have zero gutter. * artifacts of rendering at tile edges to be ignored. Set a
* * gutter value that is equal to half the size of the widest
* @type Int * symbol that needs to be displayed. Defaults to zero.
*/ * Non-tiled layers always have zero gutter.
*/
gutter: 0, gutter: 0,
/** @type String */ /**
* Property: projection
* {String} Set in the layer options to override the default projection
* string this layer - also set maxExtent, maxResolution, and
* units if appropriate.
*/
projection: null, projection: null,
/** @type String */ /**
* Property: units
* {String} The layer map units. Defaults to 'degrees'. Possible values
* are 'degrees' (or 'dd'), 'm', 'ft', 'km', 'mi', 'inches'.
*/
units: null, units: null,
/** @type Array */ /**
* Property: scales
* {Array}
*/
scales: null, scales: null,
/** @type Array */ /**
* Property: resolutions
* {Array}
*/
resolutions: null, resolutions: null,
/** @type OpenLayers.Bounds */ /**
* Property: maxExtent
* {<OpenLayers.Bounds>}
*/
maxExtent: null, maxExtent: null,
/** @type OpenLayers.Bounds */ /**
* Property: minExtent
* {<OpenLayers.Bounds>}
*/
minExtent: null, minExtent: null,
/** @type float */ /**
* Property: maxResolution
* {Float} Default max is 360 deg / 256 px, which corresponds to
* zoom level 0 on gmaps. Specify a different value in the layer
* options if you are not using a geographic projection and
* displaying the whole world.
*/
maxResolution: null, maxResolution: null,
/** @type float */ /**
* Property: minResolution
* {Float}
*/
minResolution: null, minResolution: null,
/** @type int */ /**
* Property: numZoomLevels
* {Integer}
*/
numZoomLevels: null, numZoomLevels: null,
/** @type float */ /**
* Property: minScale
* {Float}
*/
minScale: null, minScale: null,
/** @type float */ /**
* Property: maxScale
* {Float}
*/
maxScale: null, maxScale: null,
/** @type Boolean */ /**
* Property: displayOutsideMaxExtent
* {Boolean} Request map tiles that are completely outside of the max extent
* for this layer. Defaults to false
*/
displayOutsideMaxExtent: false, displayOutsideMaxExtent: false,
/** /**
* wrapDateLine -- #487 for more info. * Property: wrapDateLine
* * {Boolean} #487 for more info.
* @type Boolean
*/ */
wrapDateLine: false, wrapDateLine: false,
/** /**
* @constructor * Constructor: OpenLayers.Layer
* *
* @param {String} name * Parameters:
* @param {Object} options Hashtable of extra options to tag onto the layer * name - {String} The layer name
* options - {Object} Hashtable of extra options to tag onto the layer
*/ */
initialize: function(name, options) { initialize: function(name, options) {
@@ -179,12 +235,14 @@ OpenLayers.Layer.prototype = {
}, },
/** /**
* Method: destroy
* Destroy is a destructor: this is to alleviate cyclic references which * Destroy is a destructor: this is to alleviate cyclic references which
* the Javascript garbage cleaner can not take care of on its own. * the Javascript garbage cleaner can not take care of on its own.
* *
* @param {Boolean} setNewBaseLayer Should a new baselayer be selected when * Parameters:
* this has been removed? * setNewBaseLayer - {Boolean} Should a new baselayer be selected when
* Default is true * this has been removed?
* Default is true.
*/ */
destroy: function(setNewBaseLayer) { destroy: function(setNewBaseLayer) {
if (setNewBaseLayer == null) { if (setNewBaseLayer == null) {
@@ -205,8 +263,13 @@ OpenLayers.Layer.prototype = {
}, },
/** /**
* @returns An exact clone of this OpenLayers.Layer * Method: clone
* @type OpenLayers.Layer *
* Parameters:
* obj - {<OpenLayers.Layer>} The layer to be cloned
*
* Return:
* {<OpenLayers.Layer>} An exact clone of this <OpenLayers.Layer>
*/ */
clone: function (obj) { clone: function (obj) {
@@ -225,7 +288,10 @@ OpenLayers.Layer.prototype = {
}, },
/** /**
* @param {String} newName * APIMethod: setName
*
* Parameters:
* newName - {String}
*/ */
setName: function(newName) { setName: function(newName) {
if (newName != this.name) { if (newName != this.name) {
@@ -237,7 +303,10 @@ OpenLayers.Layer.prototype = {
}, },
/** /**
* @param {Object} newOptions * APIMethod: addOptions
*
* Parameters:
* newOptions - {Object}
*/ */
addOptions: function (newOptions) { addOptions: function (newOptions) {
@@ -253,17 +322,21 @@ OpenLayers.Layer.prototype = {
}, },
/** /**
* * APIMethod: onMapResize
* This function can be implemented by subclasses
*/ */
onMapResize: function() { onMapResize: function() {
//this function can be implemented by subclasses //this function can be implemented by subclasses
}, },
/** /**
* @param {OpenLayers.Bounds} bound * Method: moveTo
* @param {Boolean} zoomChanged tells when zoom has changed, as layers *
* have to do some init work in that case. * Parameters:
* @param {Boolean} dragging * bound - {<OpenLayers.Bounds>}
* zoomChanged - {Boolean} Tells when zoom has changed, as layers
* have to do some init work in that case.
* dragging - {Boolean}
*/ */
moveTo:function(bounds, zoomChanged, dragging) { moveTo:function(bounds, zoomChanged, dragging) {
var display = this.visibility; var display = this.visibility;
@@ -273,14 +346,17 @@ OpenLayers.Layer.prototype = {
this.display(display); this.display(display);
}, },
/** Set the map property for the layer. This is done through an accessor /**
* so that subclasses can override this and take special action once * Method: setMap
* they have their map variable set. * Set the map property for the layer. This is done through an accessor
* so that subclasses can override this and take special action once
* they have their map variable set.
* *
* Here we take care to bring over any of the necessary default properties * Here we take care to bring over any of the necessary default properties
* from the map. * from the map.
* *
* @param {OpenLayers.Map} map * Parameters:
* map - {<OpenLayers.Map>}
*/ */
setMap: function(map) { setMap: function(map) {
if (this.map == null) { if (this.map == null) {
@@ -307,10 +383,12 @@ OpenLayers.Layer.prototype = {
}, },
/** /**
* APIMethod: setTileSize
* Set the tile size based on the map size. This also sets layer.imageSize * Set the tile size based on the map size. This also sets layer.imageSize
* and layer.imageOffset for use by Tile.Image. * and layer.imageOffset for use by Tile.Image.
* *
* @param {OpenLayers.Size} * Parameters:
* size - {<OpenLayers.Size>}
*/ */
setTileSize: function(size) { setTileSize: function(size) {
var tileSize = (size) ? size : var tileSize = (size) ? size :
@@ -336,25 +414,30 @@ OpenLayers.Layer.prototype = {
}, },
/** /**
* @returns Whether or not the layer should be displayed (if in range) * APIMethod: getVisibility
* @type Boolean *
*/ * Return:
* {Boolean} Whether or not the layer should be displayed (if in range)
*/
getVisibility: function() { getVisibility: function() {
return this.visibility; return this.visibility;
}, },
/** Set the visibility flag for the layer and hide/show&redraw accordingly. /**
* Fire event unless otherwise specified * APIMethod: setVisibility
* Set the visibility flag for the layer and hide/show&redraw accordingly.
* Fire event unless otherwise specified
* *
* Note that visibility is no longer simply whether or not the layer's * Note that visibility is no longer simply whether or not the layer's
* style.display is set to "block". Now we store a 'visibility' state * style.display is set to "block". Now we store a 'visibility' state
* property on the layer class, this allows us to remember whether or not * property on the layer class, this allows us to remember whether or
* we *desire* for a layer to be visible. In the case where the map's * not we *desire* for a layer to be visible. In the case where the
* resolution is out of the layer's range, this desire may be subverted. * map's resolution is out of the layer's range, this desire may be
* * subverted.
* @param {Boolean} visible Whether or not to display the layer *
* (if in range) * Parameters:
* @param {Boolean} noEvent * visible - {Boolean} Whether or not to display the layer (if in range)
* noEvent - {Boolean}
*/ */
setVisibility: function(visibility, noEvent) { setVisibility: function(visibility, noEvent) {
if (visibility != this.visibility) { if (visibility != this.visibility) {
@@ -373,9 +456,12 @@ OpenLayers.Layer.prototype = {
} }
}, },
/** Hide or show the Layer /**
* APIMethod: display
* Hide or show the Layer
* *
* @param {Boolean} display * Parameters:
* display - {Boolean}
*/ */
display: function(display) { display: function(display) {
if (display != (this.div.style.display != "none")) { if (display != (this.div.style.display != "none")) {
@@ -384,9 +470,11 @@ OpenLayers.Layer.prototype = {
}, },
/** /**
* @returns Whether or not the layer is displayable at the current map's * Method: calculateInRange
* current resolution *
* @type Boolean * Return:
* {Boolean} Whether or not the layer is displayable at the current map's
* current resolution
*/ */
calculateInRange: function() { calculateInRange: function() {
var inRange = false; var inRange = false;
@@ -399,7 +487,10 @@ OpenLayers.Layer.prototype = {
}, },
/** /**
* @param {Boolean} isBaseLayer * APIMethod: setIsBaseLayer
*
* Parameters:
* isBaseLayer - {Boolean}
*/ */
setIsBaseLayer: function(isBaseLayer) { setIsBaseLayer: function(isBaseLayer) {
if (isBaseLayer != this.isBaseLayer) { if (isBaseLayer != this.isBaseLayer) {
@@ -416,19 +507,19 @@ OpenLayers.Layer.prototype = {
/* */ /* */
/********************************************************/ /********************************************************/
/** This method's responsibility is to set up the 'resolutions' array /**
* for the layer -- this array is what the layer will use to interface * Method: initResolutions
* between the zoom levels of the map and the resolution display of the * This method's responsibility is to set up the 'resolutions' array
* layer. * for the layer -- this array is what the layer will use to interface
* between the zoom levels of the map and the resolution display
* of the layer.
* *
* The user has several options that determine how the array is set up. * The user has several options that determine how the array is set up.
* *
* For a detailed explanation, see the following wiki from the * For a detailed explanation, see the following wiki from the
* openlayers.org homepage: * openlayers.org homepage:
* *
* http://trac.openlayers.org/wiki/SettingZoomLevels * http://trac.openlayers.org/wiki/SettingZoomLevels
*
* @private
*/ */
initResolutions: function() { initResolutions: function() {
@@ -550,9 +641,11 @@ OpenLayers.Layer.prototype = {
}, },
/** /**
* @returns The currently selected resolution of the map, taken from the * APIMethod: getResolution
* resolutions array, indexed by current zoom level. *
* @type float * Return:
* {Float} The currently selected resolution of the map, taken from the
* resolutions array, indexed by current zoom level.
*/ */
getResolution: function() { getResolution: function() {
var zoom = this.map.getZoom(); var zoom = this.map.getZoom();
@@ -560,9 +653,11 @@ OpenLayers.Layer.prototype = {
}, },
/** /**
* @returns A Bounds object which represents the lon/lat bounds of the * APIMethod: getExtent
* current viewPort. *
* @type OpenLayers.Bounds * Return:
* {<OpenLayers.Bounds>} A Bounds object which represents the lon/lat
* bounds of the current viewPort.
*/ */
getExtent: function() { getExtent: function() {
// just use stock map calculateBounds function -- passing no arguments // just use stock map calculateBounds function -- passing no arguments
@@ -572,14 +667,17 @@ OpenLayers.Layer.prototype = {
}, },
/** /**
* @param {OpenLayers.Bounds} bounds * APIMethod: getZoomForExtent
*
* Parameters:
* bounds - {<OpenLayers.Bounds>}
* *
* @returns The index of the zoomLevel (entry in the resolutions array) * Return:
* {Integer} The index of the zoomLevel (entry in the resolutions array)
* that still contains the passed-in extent. We do this by * that still contains the passed-in extent. We do this by
* calculating the ideal resolution for the given exteng (based * calculating the ideal resolution for the given exteng (based
* on the map size) and then find the smallest resolution that * on the map size) and then find the smallest resolution that
* is greater than this ideal resolution. * is greater than this ideal resolution.
* @type int
*/ */
getZoomForExtent: function(extent) { getZoomForExtent: function(extent) {
var viewSize = this.map.getSize(); var viewSize = this.map.getSize();
@@ -590,12 +688,15 @@ OpenLayers.Layer.prototype = {
}, },
/** /**
* @param {float} resolution * APIMethod: getZoomForResolution
* *
* @returns The index of the zoomLevel (entry in the resolutions array) * Parameters:
* resolution - {Float}
*
* Return:
* {Integer} The index of the zoomLevel (entry in the resolutions array)
* that is the smallest resolution that is greater than the * that is the smallest resolution that is greater than the
* passed-in resolution. * passed-in resolution.
* @type int
*/ */
getZoomForResolution: function(resolution) { getZoomForResolution: function(resolution) {
@@ -608,11 +709,15 @@ OpenLayers.Layer.prototype = {
}, },
/** /**
* @param {OpenLayers.Pixel} viewPortPx * APIMethod: getLonLatFromViewPortPx
*
* Parameters:
* viewPortPx - {<OpenLayers.Pixel>}
* *
* @returns An OpenLayers.LonLat which is the passed-in view port * Return:
* OpenLayers.Pixel, translated into lon/lat by the layer * {<OpenLayers.LonLat>} An OpenLayers.LonLat which is the passed-in
* @type OpenLayers.LonLat * view port <OpenLayers.Pixel>, translated into
* lon/lat by the layer
*/ */
getLonLatFromViewPortPx: function (viewPortPx) { getLonLatFromViewPortPx: function (viewPortPx) {
var lonlat = null; var lonlat = null;
@@ -637,11 +742,15 @@ OpenLayers.Layer.prototype = {
}, },
/** /**
* @param {OpenLayers.LonLat} lonlat * APIMethod: getViewPortPxFromLonLat
*
* Parameters:
* lonlat - {<OpenLayers.LonLat>}
* *
* @returns An OpenLayers.Pixel which is the passed-in OpenLayers.LonLat, * Return:
* translated into view port pixels * {<OpenLayers.Pixel>} An <OpenLayers.Pixel> which is the passed-in
* @type OpenLayers.Pixel * <OpenLayers.LonLat>,translated into view
* port pixels.
*/ */
getViewPortPxFromLonLat: function (lonlat) { getViewPortPxFromLonLat: function (lonlat) {
var px = null; var px = null;
@@ -657,8 +766,11 @@ OpenLayers.Layer.prototype = {
}, },
/** /**
* APIMethod: setOpacity
* Sets the opacity for the entire layer (all images) * Sets the opacity for the entire layer (all images)
* @param {Float} opacity *
* Parameter:
* opacity - {Float}
*/ */
setOpacity: function(opacity) { setOpacity: function(opacity) {
if (opacity != this.opacity) { if (opacity != this.opacity) {
@@ -672,22 +784,26 @@ OpenLayers.Layer.prototype = {
}, },
/** /**
* @param {int} zIdx * Method: setZIndex
* @private *
*/ * Parameters:
setZIndex: function (zIdx) { * zIndex - {Integer}
this.div.style.zIndex = zIdx; */
setZIndex: function (zIndex) {
this.div.style.zIndex = zIndex;
}, },
/** /**
* This function will take a bounds, and if wrapDateLine option is set * Method: adjustBounds
* on the layer, it will return a bounds which is wrapped around the world. * This function will take a bounds, and if wrapDateLine option is set
* We do not wrap for bounds which *cross* the maxExtent.left/right, only * on the layer, it will return a bounds which is wrapped around the
* bounds which are entirely to the left or entirely to the right. * world. We do not wrap for bounds which *cross* the
* * maxExtent.left/right, only bounds which are entirely to the left
* @param {OpenLayers.Bounds} bounds * or entirely to the right.
* @private *
*/ * Parameters:
* bounds - {<OpenLayers.Bounds>}
*/
adjustBounds: function (bounds) { adjustBounds: function (bounds) {
if (this.gutter) { if (this.gutter) {
+19 -11
View File
@@ -4,31 +4,37 @@
/** /**
* @class
*
* @requires OpenLayers/Layer.js * @requires OpenLayers/Layer.js
* @requires OpenLayers/Layer/Markers.js * @requires OpenLayers/Layer/Markers.js
*
* Class: OpenLayers.Layer.Boxes
* Draw divs as 'boes' on the layer.
*
* Inherits from:
* - <OpenLayers.Layer.Markers>
*/ */
OpenLayers.Layer.Boxes = OpenLayers.Class.create(); OpenLayers.Layer.Boxes = OpenLayers.Class.create();
OpenLayers.Layer.Boxes.prototype = OpenLayers.Layer.Boxes.prototype =
OpenLayers.Class.inherit( OpenLayers.Layer.Markers, { OpenLayers.Class.inherit( OpenLayers.Layer.Markers, {
/** /**
* @constructor * Constructor: OpenLayers.Layer.Boxes
* *
* @param {String} name * Parameters:
* @param {Object} options Hashtable of extra options to tag onto the layer * name - {String}
* options - {Object} Hashtable of extra options to tag onto the layer
*/ */
initialize: function (name, options) { initialize: function (name, options) {
OpenLayers.Layer.Markers.prototype.initialize.apply(this, arguments); OpenLayers.Layer.Markers.prototype.initialize.apply(this, arguments);
}, },
/** Calculate the pixel location for the marker, create it, and /**
* Method: drawMarker
* Calculate the pixel location for the marker, create it, and
* add it to the layer's div * add it to the layer's div
* *
* @private * Parameters:
* * marker - {<OpenLayers.Marker.Box>}
* @param {OpenLayers.Marker.Box} marker
*/ */
drawMarker: function(marker) { drawMarker: function(marker) {
var bounds = marker.bounds; var bounds = marker.bounds;
@@ -51,9 +57,11 @@ OpenLayers.Layer.Boxes.prototype =
}, },
/** OVERRIDDEN /**
* APIMethod: removeMarker
* *
* @param {OpenLayers.Marker} marker * Parameters:
* marker - {<OpenLayers.Marker.Box>}
*/ */
removeMarker: function(marker) { removeMarker: function(marker) {
OpenLayers.Util.removeItem(this.markers, marker); OpenLayers.Util.removeItem(this.markers, marker);
+114 -59
View File
@@ -4,42 +4,55 @@
/** /**
* @class
*
* @requires OpenLayers/Layer.js * @requires OpenLayers/Layer.js
* @requires OpenLayers/Util.js * @requires OpenLayers/Util.js
*
* Class: OpenLayers.Layer.EventPane
* Base class for 3rd party layers. Create a new event pane layer with the
* <OpenLayers.Layer.EventPane> constructor.
*
* Inherits from:
* - <OpenLayers.Layer>
*/ */
OpenLayers.Layer.EventPane = OpenLayers.Class.create(); OpenLayers.Layer.EventPane = OpenLayers.Class.create();
OpenLayers.Layer.EventPane.prototype = OpenLayers.Layer.EventPane.prototype =
OpenLayers.Class.inherit( OpenLayers.Layer, { OpenLayers.Class.inherit( OpenLayers.Layer, {
/** EventPaned layers are always base layers, by necessity. /**
* * Property: isBaseLayer
* @type Boolean */ * {Boolean} EventPaned layers are always base layers, by necessity.
*/
isBaseLayer: true, isBaseLayer: true,
/** EventPaned layers are fixed by default. /**
* * APIProperty: isFixed
* @type Boolean */ * {Boolean} EventPaned layers are fixed by default.
*/
isFixed: true, isFixed: true,
/** @type DOMElement */ /**
* Property: pane
* {DOMElement} A reference to the element that controls the events.
*/
pane: null, pane: null,
/** This is the object which will be used to load the 3rd party library /**
* in the case of the google layer, this will be of type GMap, * Property: mapObject
* in the case of the ve layer, this will be of type VEMap * {Object} This is the object which will be used to load the 3rd party library
* * in the case of the google layer, this will be of type GMap,
* @type Object */ * in the case of the ve layer, this will be of type VEMap
*/
mapObject: null, mapObject: null,
/** /**
* @constructor * Constructor: OpenLayers.Layer.EventPane
* * Create a new event pane layer
* @param {String} name *
* @param {Object} options Hashtable of extra options to tag onto the layer * Parameters:
* name - {String}
* options - {Object} Hashtable of extra options to tag onto the layer
*/ */
initialize: function(name, options) { initialize: function(name, options) {
OpenLayers.Layer.prototype.initialize.apply(this, arguments); OpenLayers.Layer.prototype.initialize.apply(this, arguments);
@@ -49,7 +62,8 @@ OpenLayers.Layer.EventPane.prototype =
}, },
/** /**
* * APIMethod: destroy
* Deconstruct this layer.
*/ */
destroy: function() { destroy: function() {
this.mapObject = null; this.mapObject = null;
@@ -57,11 +71,14 @@ OpenLayers.Layer.EventPane.prototype =
}, },
/** Set the map property for the layer. This is done through an accessor /**
* so that subclasses can override this and take special action once * Method: setMap
* they have their map variable set. * Set the map property for the layer. This is done through an accessor
* * so that subclasses can override this and take special action once
* @param {OpenLayers.Map} map * they have their map variable set.
*
* Parameters:
* map - {<OpenLayers.Map>}
*/ */
setMap: function(map) { setMap: function(map) {
OpenLayers.Layer.prototype.setMap.apply(this, arguments); OpenLayers.Layer.prototype.setMap.apply(this, arguments);
@@ -90,11 +107,10 @@ OpenLayers.Layer.EventPane.prototype =
} }
}, },
/** If we can't load the GMap, then display an error message to the /**
* user and tell them where to go for help. * Method: loadWarningMessage
* * If we can't load the map lib, then display an error message to the
* @private * user and tell them where to go for help.
*
*/ */
loadWarningMessage:function() { loadWarningMessage:function() {
@@ -126,8 +142,12 @@ OpenLayers.Layer.EventPane.prototype =
}, },
/** /**
* @param {Boolean} display * Method: display
* Set the display on the pane
*
* Parameters:
* display - {Boolean}
*/ */
display: function(display) { display: function(display) {
OpenLayers.Layer.prototype.display.apply(this, arguments); OpenLayers.Layer.prototype.display.apply(this, arguments);
@@ -135,17 +155,25 @@ OpenLayers.Layer.EventPane.prototype =
}, },
/** /**
* @param {int} zIndex * Method: setZIndex
* Set the z-index order for the pane.
*
* Parameters:
* zIndex - {int}
*/ */
setZIndex: function (zIndex) { setZIndex: function (zIndex) {
OpenLayers.Layer.prototype.setZIndex.apply(this, arguments); OpenLayers.Layer.prototype.setZIndex.apply(this, arguments);
this.pane.style.zIndex = parseInt(this.div.style.zIndex) + 1; this.pane.style.zIndex = parseInt(this.div.style.zIndex) + 1;
}, },
/** /**
* @param {OpenLayers.Bounds} bounds * Method: moveTo
* @param {Boolean} zoomChanged * Handle calls to move the layer.
* @param {Boolean} dragging *
* Parameters:
* bounds - {<OpenLayers.Bounds>}
* zoomChanged - {Boolean}
* dragging - {Boolean}
*/ */
moveTo:function(bounds, zoomChanged, dragging) { moveTo:function(bounds, zoomChanged, dragging) {
OpenLayers.Layer.prototype.moveTo.apply(this, arguments); OpenLayers.Layer.prototype.moveTo.apply(this, arguments);
@@ -182,12 +210,16 @@ OpenLayers.Layer.EventPane.prototype =
/********************************************************/ /********************************************************/
/** /**
* @param {OpenLayers.Pixel} viewPortPx * Method: getLonLatFromViewPortPx
* Get a map location from a pixel location
*
* Parameters:
* viewPortPx - {<OpenLayers.Pixel>}
* *
* @returns An OpenLayers.LonLat which is the passed-in view port * Return:
* OpenLayers.Pixel, translated into lon/lat by GMAPS * {<OpenLayers.LonLat>} An OpenLayers.LonLat which is the passed-in view
* If gmap is not loaded or not centered, returns null * port OpenLayers.Pixel, translated into lon/lat by map lib
* @type OpenLayers.LonLat * If the map lib is not loaded or not centered, returns null
*/ */
getLonLatFromViewPortPx: function (viewPortPx) { getLonLatFromViewPortPx: function (viewPortPx) {
var lonlat = null; var lonlat = null;
@@ -202,12 +234,16 @@ OpenLayers.Layer.EventPane.prototype =
/** /**
* @param {OpenLayers.LonLat} lonlat * Method: getViewPortPxFromLonLat
* Get a pixel location from a map location
* *
* @returns An OpenLayers.Pixel which is the passed-in OpenLayers.LonLat, * Parameters:
* translated into view port pixels BY GMAPS * lonlat - {<OpenLayers.LonLat>}
* If gmap is not loaded or not centered, returns null *
* @type OpenLayers.Pixel * Return:
* {<OpenLayers.Pixel>} An OpenLayers.Pixel which is the passed-in
* OpenLayers.LonLat, translated into view port pixels by map lib
* If map lib is not loaded or not centered, returns null
*/ */
getViewPortPxFromLonLat: function (lonlat) { getViewPortPxFromLonLat: function (lonlat) {
var viewPortPx = null; var viewPortPx = null;
@@ -236,12 +272,16 @@ OpenLayers.Layer.EventPane.prototype =
// //
/** /**
* @param {Object} moLonLat * Method: getOLLonLatFromMapObjectLonLat
* Get an OL style map location from a 3rd party style map location
*
* Parameters
* moLonLat - {Object}
* *
* @returns An OpenLayers.LonLat, translated from the passed in * Return:
* {<OpenLayers.LonLat>} An OpenLayers.LonLat, translated from the passed in
* MapObject LonLat * MapObject LonLat
* Returns null if null value is passed in * Returns null if null value is passed in
* @type OpenLayers.LonLat
*/ */
getOLLonLatFromMapObjectLonLat: function(moLonLat) { getOLLonLatFromMapObjectLonLat: function(moLonLat) {
var olLonLat = null; var olLonLat = null;
@@ -254,12 +294,16 @@ OpenLayers.Layer.EventPane.prototype =
}, },
/** /**
* @param {OpenLayers.LonLat} olLonLat * Method: getMapObjectLonLatFromOLLonLat
* Get a 3rd party map location from an OL map location.
*
* Parameters:
* olLonLat - {<OpenLayers.LonLat>}
* *
* @returns A MapObject LonLat, translated from the passed in * Return:
* {Object} A MapObject LonLat, translated from the passed in
* OpenLayers.LonLat * OpenLayers.LonLat
* Returns null if null value is passed in * Returns null if null value is passed in
* @type Object
*/ */
getMapObjectLonLatFromOLLonLat: function(olLonLat) { getMapObjectLonLatFromOLLonLat: function(olLonLat) {
var moLatLng = null; var moLatLng = null;
@@ -276,12 +320,16 @@ OpenLayers.Layer.EventPane.prototype =
// //
/** /**
* @param {Object} moPixel * Method: getOLPixelFromMapObjectPixel
* Get an OL pixel location from a 3rd party pixel location.
*
* Parameters:
* moPixel - {Object}
* *
* @returns An OpenLayers.Pixel, translated from the passed in * Return:
* {<OpenLayers.Pixel>} An OpenLayers.Pixel, translated from the passed in
* MapObject Pixel * MapObject Pixel
* Returns null if null value is passed in * Returns null if null value is passed in
* @type OpenLayers.Pixel
*/ */
getOLPixelFromMapObjectPixel: function(moPixel) { getOLPixelFromMapObjectPixel: function(moPixel) {
var olPixel = null; var olPixel = null;
@@ -294,12 +342,16 @@ OpenLayers.Layer.EventPane.prototype =
}, },
/** /**
* @param {OpenLayers.Pixel} olPixel * Method: getMapObjectPixelFromOLPixel
* Get a 3rd party pixel location from an OL pixel location
*
* Parameters:
* olPixel - {<OpenLayers.Pixel>}
* *
* @returns A MapObject Pixel, translated from the passed in * Return:
* {Object} A MapObject Pixel, translated from the passed in
* OpenLayers.Pixel * OpenLayers.Pixel
* Returns null if null value is passed in * Returns null if null value is passed in
* @type Object
*/ */
getMapObjectPixelFromOLPixel: function(olPixel) { getMapObjectPixelFromOLPixel: function(olPixel) {
var moPixel = null; var moPixel = null;
@@ -309,6 +361,9 @@ OpenLayers.Layer.EventPane.prototype =
return moPixel; return moPixel;
}, },
/** @final @type String */ /**
* Constant: CLASS_NAME
* {String} Name of this class
*/
CLASS_NAME: "OpenLayers.Layer.EventPane" CLASS_NAME: "OpenLayers.Layer.EventPane"
}); });
+62 -45
View File
@@ -2,10 +2,10 @@
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt * See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
* for the full text of the license. */ * for the full text of the license. */
/**
* @requires OpenLayers/Layer.js
*
/** * Class: OpenLayers.Layer.FixedZoomLevels
* Some Layers will already have established zoom levels (like google * Some Layers will already have established zoom levels (like google
* or ve). Instead of trying to determine them and populate a resolutions[] * or ve). Instead of trying to determine them and populate a resolutions[]
* Array with those values, we will hijack the resolution functionality * Array with those values, we will hijack the resolution functionality
@@ -37,15 +37,13 @@
* Whenever you implement a layer using OpenLayers.Layer.FixedZoomLevels, * Whenever you implement a layer using OpenLayers.Layer.FixedZoomLevels,
* it is your responsibility to provide the following three functions: * it is your responsibility to provide the following three functions:
* *
* - getLonLatFromViewPortPx() * - getLonLatFromViewPortPx
* - getViewPortPxFromLonLat() * - getViewPortPxFromLonLat
* - getZoomForExtent() * - getZoomForExtent
* *
* ...those three functions should generally be provided by any reasonable * ...those three functions should generally be provided by any reasonable
* API that you might be working from. * API that you might be working from.
* *
* @requires OpenLayers/Layer.js
* @class
*/ */
OpenLayers.Layer.FixedZoomLevels = OpenLayers.Class.create(); OpenLayers.Layer.FixedZoomLevels = OpenLayers.Class.create();
OpenLayers.Layer.FixedZoomLevels.prototype = { OpenLayers.Layer.FixedZoomLevels.prototype = {
@@ -60,7 +58,8 @@ OpenLayers.Layer.FixedZoomLevels.prototype = {
/********************************************************/ /********************************************************/
/** /**
* @constructor * Constructor: OpenLayers.Layer.FixedZoomLevels
* Create a new fixed zoom levels layer.
*/ */
initialize: function() { initialize: function() {
//this class is only just to add the following functions... //this class is only just to add the following functions...
@@ -71,7 +70,8 @@ OpenLayers.Layer.FixedZoomLevels.prototype = {
}, },
/** /**
* * Method: initResolutions
* Populate the resolutions array
*/ */
initResolutions: function() { initResolutions: function() {
@@ -112,9 +112,12 @@ OpenLayers.Layer.FixedZoomLevels.prototype = {
} }
}, },
/** /**
* @returns Degrees per Pixel * APIMethod: getResolution
* @type float * Get the current map resolution
*
* Return:
* {Float} Map units per Pixel
*/ */
getResolution: function() { getResolution: function() {
@@ -134,12 +137,14 @@ OpenLayers.Layer.FixedZoomLevels.prototype = {
} }
}, },
/** Calculates using px-> lonlat translation functions on tl and br /**
* corners of viewport * APIMethod: getExtent
* Calculates using px-> lonlat translation functions on tl and br
* corners of viewport
* *
* @returns A Bounds object which represents the lon/lat bounds of the * Return:
* current viewPort. * {<OpenLayers.Bounds>} A Bounds object which represents the lon/lat
* @type OpenLayers.Bounds * bounds of the current viewPort.
*/ */
getExtent: function () { getExtent: function () {
var extent = null; var extent = null;
@@ -164,11 +169,15 @@ OpenLayers.Layer.FixedZoomLevels.prototype = {
}, },
/** /**
* @param {float} resolution * Method: getZoomForResolution
* Get the zoom level for a given resolution
* *
* @returns A suitable zoom level for the specified resolution. * Parameters:
* If no baselayer is set, returns null. * resolution - {Float}
* @type int *
* Return:
* {Integer} A suitable zoom level for the specified resolution.
* If no baselayer is set, returns null.
*/ */
getZoomForResolution: function(resolution) { getZoomForResolution: function(resolution) {
@@ -185,26 +194,30 @@ OpenLayers.Layer.FixedZoomLevels.prototype = {
/********************************************************/ /********************************************************/
/* */ /* */
/* Translation Functions */ /* Translation Functions */
/* */ /* */
/* The following functions translate GMaps and OL */ /* The following functions translate GMaps and OL */
/* formats for Pixel, LonLat, Bounds, and Zoom */ /* formats for Pixel, LonLat, Bounds, and Zoom */
/* */ /* */
/********************************************************/ /********************************************************/
// //
// TRANSLATION: MapObject Zoom <-> OpenLayers Zoom // TRANSLATION: MapObject Zoom <-> OpenLayers Zoom
// //
/** /**
* @param {int} gZoom * Method: getOLZoomFromMapObjectZoom
* Get the OL zoom index from the map object zoom level
*
* Parameters:
* moZoom - {Integer}
* *
* @returns An OpenLayers Zoom level, translated from the passed in gZoom * Return:
* Returns null if null value is passed in * {Integer} An OpenLayers Zoom level, translated from the passed in zoom
* @type int * Returns null if null value is passed in
*/ */
getOLZoomFromMapObjectZoom: function(moZoom) { getOLZoomFromMapObjectZoom: function(moZoom) {
var zoom = null; var zoom = null;
@@ -215,11 +228,15 @@ OpenLayers.Layer.FixedZoomLevels.prototype = {
}, },
/** /**
* @param {int} olZoom * Method: getMapObjectZoomFromOLZoom
* Get the map object zoom level from the OL zoom level
*
* Parameters:
* olZoom - {Integer}
* *
* @returns A MapObject level, translated from the passed in olZoom * Return:
* Returns null if null value is passed in * {Integer} A MapObject level, translated from the passed in olZoom
* @type int * Returns null if null value is passed in
*/ */
getMapObjectZoomFromOLZoom: function(olZoom) { getMapObjectZoomFromOLZoom: function(olZoom) {
var zoom = null; var zoom = null;
+42 -21
View File
@@ -3,32 +3,41 @@
* for the full text of the license. */ * for the full text of the license. */
/** /**
* Create a vector layer by parsing a GML file. The GML file is
* passed in as a parameter.
* @class
*
* @requires OpenLayers/Layer/Vector.js * @requires OpenLayers/Layer/Vector.js
* @requires OpenLayers/Ajax.js * @requires OpenLayers/Ajax.js
* Class: OpenLayers.Layer.GML
* Create a vector layer by parsing a GML file. The GML file is
* passed in as a parameter.
*
* Inherits from:
* - <OpenLayers.Layer.Vector>
*/ */
OpenLayers.Layer.GML = OpenLayers.Class.create(); OpenLayers.Layer.GML = OpenLayers.Class.create();
OpenLayers.Layer.GML.prototype = OpenLayers.Layer.GML.prototype =
OpenLayers.Class.inherit( OpenLayers.Layer.Vector, { OpenLayers.Class.inherit( OpenLayers.Layer.Vector, {
/** /**
* Flag for whether the GML data has been loaded yet. * Property: loaded
* @type Boolean * {Boolean} Flag for whether the GML data has been loaded yet.
*/ */
loaded: false, loaded: false,
/**
* APIProperty: format
* {<OpenLayers.Format>} The format you want the data to be parsed with.
*/
format: null, format: null,
/** /**
* @constructor * Constructor: OpenLayers.Layer.GML
* * Load and parse a single file on the web, according to the format
* @param {String} name * provided via the 'format' option, defaulting to GML.
* @param {String} url URL of a GML file. *
* @param {Object} options Hashtable of extra options to tag onto the layer. * Parameters:
* Options renderer {Object}: Typically SvgRenderer or VmlRenderer. * name - {String}
* url - {String} URL of a GML file.
* options - {Object} Hashtable of extra options to tag onto the layer.
*/ */
initialize: function(name, url, options) { initialize: function(name, url, options) {
var newArguments = new Array() var newArguments = new Array()
@@ -38,14 +47,16 @@ OpenLayers.Layer.GML.prototype =
}, },
/** /**
* APIMethod: setVisibility
* Set the visibility flag for the layer and hide/show&redraw accordingly. * Set the visibility flag for the layer and hide/show&redraw accordingly.
* Fire event unless otherwise specified * Fire event unless otherwise specified
* GML will be loaded if the layer is being made visible for the first * GML will be loaded if the layer is being made visible for the first
* time. * time.
* *
* @param {Boolean} visible Whether or not to display the layer * Parameters:
* visible - {Boolean} Whether or not to display the layer
* (if in range) * (if in range)
* @param {Boolean} noEvent * noEvent - {Boolean}
*/ */
setVisibility: function(visibility, noEvent) { setVisibility: function(visibility, noEvent) {
OpenLayers.Layer.Vector.prototype.setVisibility.apply(this, arguments); OpenLayers.Layer.Vector.prototype.setVisibility.apply(this, arguments);
@@ -56,11 +67,14 @@ OpenLayers.Layer.GML.prototype =
}, },
/** /**
* Method: moveTo
* If layer is visible and GML has not been loaded, load GML, then load GML * If layer is visible and GML has not been loaded, load GML, then load GML
* and call OpenLayers.Layer.Vector.moveTo() to redraw at the new location. * and call OpenLayers.Layer.Vector.moveTo() to redraw at the new location.
* @param {Object} bounds *
* @param {Object} zoomChanged * Parameters:
* @param {Object} minor * bounds - {Object}
* zoomChanged - {Object}
* minor - {Object}
*/ */
moveTo:function(bounds, zoomChanged, minor) { moveTo:function(bounds, zoomChanged, minor) {
OpenLayers.Layer.Vector.prototype.moveTo.apply(this, arguments); OpenLayers.Layer.Vector.prototype.moveTo.apply(this, arguments);
@@ -73,6 +87,9 @@ OpenLayers.Layer.GML.prototype =
} }
}, },
/**
* Method: loadGML
*/
loadGML: function() { loadGML: function() {
if (!this.loaded) { if (!this.loaded) {
var results = OpenLayers.loadURL(this.url, null, this, this.requestSuccess, this.requestFailure); var results = OpenLayers.loadURL(this.url, null, this, this.requestSuccess, this.requestFailure);
@@ -82,10 +99,12 @@ OpenLayers.Layer.GML.prototype =
/** /**
* Method: requestSuccess
* Process GML after it has been loaded. * Process GML after it has been loaded.
* Called by initialise() and loadUrl() after the GML has been loaded. * Called by initialise() and loadUrl() after the GML has been loaded.
* @private *
* @param {String} request * Parameters:
* request - {String}
*/ */
requestSuccess:function(request) { requestSuccess:function(request) {
var doc = request.responseXML; var doc = request.responseXML;
@@ -99,10 +118,12 @@ OpenLayers.Layer.GML.prototype =
}, },
/** /**
* Method: requestFailure
* Process a failed loading of GML. * Process a failed loading of GML.
* Called by initialise() and loadUrl() if there was a problem loading GML. * Called by initialise() and loadUrl() if there was a problem loading GML.
* @private *
* @param {String} request * Parameters:
* request - {String}
*/ */
requestFailure: function(request) { requestFailure: function(request) {
alert("Error in loading GML file "+this.url); alert("Error in loading GML file "+this.url);
+44 -19
View File
@@ -4,33 +4,52 @@
/** /**
* @class
*
* @requires OpenLayers/Layer/Markers.js * @requires OpenLayers/Layer/Markers.js
* @requires OpenLayers/Ajax.js * @requires OpenLayers/Ajax.js
*
* Class: OpenLayers.Layer.GeoRSS
* Add GeoRSS Point features to your map.
*
* Inherits from:
* - <OpenLayers.Layer.Markers>
* - <OpenLayers.Layer>
*/ */
OpenLayers.Layer.GeoRSS = OpenLayers.Class.create(); OpenLayers.Layer.GeoRSS = OpenLayers.Class.create();
OpenLayers.Layer.GeoRSS.prototype = OpenLayers.Layer.GeoRSS.prototype =
OpenLayers.Class.inherit( OpenLayers.Layer.Markers, { OpenLayers.Class.inherit( OpenLayers.Layer.Markers, {
/** store url of text file /**
* @type str */ * Property: location
location:null, * {String} store url of text file
*/
location: null,
/** @type Array(OpenLayers.Feature) */ /**
features: null, * Property: features
* Array({<OpenLayers.Feature>})
*/
features: null,
/** @type OpenLayers.Feature */ /**
selectedFeature: null, * Property: selectedFeature
* {<OpenLayers.Feature>}
*/
selectedFeature: null,
/**@type OpenLayers.Icon */ /**
* Property: icon
* {<OpenLayers.Icon>}
*/
icon: null, icon: null,
/** /**
* @constructor * Constructor: OpenLayers.Layer.GeoRSS
* Create a GeoRSS Layer.
* *
* @param {String} name * Parameters:
* @param {String} location * name - {String}
* location - {String}
* options - {Object}
*/ */
initialize: function(name, location, options) { initialize: function(name, location, options) {
OpenLayers.Layer.Markers.prototype.initialize.apply(this, [name, options]); OpenLayers.Layer.Markers.prototype.initialize.apply(this, [name, options]);
@@ -40,7 +59,7 @@ OpenLayers.Layer.GeoRSS.prototype =
}, },
/** /**
* * Method: destroy
*/ */
destroy: function() { destroy: function() {
this.clearFeatures(); this.clearFeatures();
@@ -49,7 +68,11 @@ OpenLayers.Layer.GeoRSS.prototype =
}, },
/** /**
* @param {XMLHttpRequest} ajaxRequest * Method: parseData
* Parse the data returned from the Events call.
*
* Parameters:
* ajaxRequest - {XMLHttpRequest}
*/ */
parseData: function(ajaxRequest) { parseData: function(ajaxRequest) {
var doc = ajaxRequest.responseXML; var doc = ajaxRequest.responseXML;
@@ -171,7 +194,10 @@ OpenLayers.Layer.GeoRSS.prototype =
}, },
/** /**
* @param {Event} evt * Method: markerClick
*
* Parameters:
* evt - {Event}
*/ */
markerClick: function(evt) { markerClick: function(evt) {
sameMarkerClicked = (this == this.layer.selectedFeature); sameMarkerClicked = (this == this.layer.selectedFeature);
@@ -193,7 +219,8 @@ OpenLayers.Layer.GeoRSS.prototype =
}, },
/** /**
* * Method: clearFeatures
* Destroy all features in this layer.
*/ */
clearFeatures: function() { clearFeatures: function() {
if (this.features != null) { if (this.features != null) {
@@ -208,5 +235,3 @@ OpenLayers.Layer.GeoRSS.prototype =
/** @final @type String */ /** @final @type String */
CLASS_NAME: "OpenLayers.Layer.GeoRSS" CLASS_NAME: "OpenLayers.Layer.GeoRSS"
}); });
+157 -87
View File
@@ -4,35 +4,51 @@
/** /**
* @class
*
* @requires OpenLayers/Layer/EventPane.js * @requires OpenLayers/Layer/EventPane.js
* @requires OpenLayers/Layer/FixedZoomLevels.js * @requires OpenLayers/Layer/FixedZoomLevels.js
*
* Class: OpenLayers.Layer.Gooogle
*
* Inherits:
* - <OpenLayers.Layer.EventPane>
* - <OpenLayers.Layer.FixedZoomLevels>
*/ */
OpenLayers.Layer.Google = OpenLayers.Class.create(); OpenLayers.Layer.Google = OpenLayers.Class.create();
OpenLayers.Layer.Google.prototype = OpenLayers.Layer.Google.prototype =
OpenLayers.Class.inherit( OpenLayers.Layer.EventPane, OpenLayers.Class.inherit( OpenLayers.Layer.EventPane,
OpenLayers.Layer.FixedZoomLevels, { OpenLayers.Layer.FixedZoomLevels, {
/** @final @type int */ /**
* Constant: MIN_ZOOM_LEVEL
* {Integer} 0
*/
MIN_ZOOM_LEVEL: 0, MIN_ZOOM_LEVEL: 0,
/** @final @type int */ /**
* Constant: MAX_ZOOM_LEVEL
* {Integer} 19
*/
MAX_ZOOM_LEVEL: 19, MAX_ZOOM_LEVEL: 19,
/** Hardcode these resolutions so that they are more closely /**
* tied with the standard wms projection * Constant: RESOLUTIONS
* * {Array(Float)} Hardcode these resolutions so that they are more closely
* @final @type Array(float) */ * tied with the standard wms projection
*/
RESOLUTIONS: [1.40625,0.703125,0.3515625,0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.001373291015625,0.0006866455078125,0.00034332275390625,0.000171661376953125,0.0000858306884765625,0.00004291534423828125,.00002145767211914062,.00001072883605957031,.00000536441802978515,.00000268220901489257], RESOLUTIONS: [1.40625,0.703125,0.3515625,0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.001373291015625,0.0006866455078125,0.00034332275390625,0.000171661376953125,0.0000858306884765625,0.00004291534423828125,.00002145767211914062,.00001072883605957031,.00000536441802978515,.00000268220901489257],
/** @type GMapType */ /**
* APIProperty: type
* {GMapType}
*/
type: null, type: null,
/** /**
* @constructor * Constructor: OpenLayers.Layer.Google
* *
* @param {String} name * Parameters:
* name - {String}
* options - {Object}
*/ */
initialize: function(name, options) { initialize: function(name, options) {
OpenLayers.Layer.EventPane.prototype.initialize.apply(this, arguments); OpenLayers.Layer.EventPane.prototype.initialize.apply(this, arguments);
@@ -41,10 +57,10 @@ OpenLayers.Layer.Google.prototype =
this.addContainerPxFunction(); this.addContainerPxFunction();
}, },
/** Load the GMap and register appropriate event listeners. If we can't /**
* load GMap2, then display a warning message. * Method: loadMapObject
* * Load the GMap and register appropriate event listeners. If we can't
* @private * load GMap2, then display a warning message.
*/ */
loadMapObject:function() { loadMapObject:function() {
@@ -75,12 +91,15 @@ OpenLayers.Layer.Google.prototype =
}, },
/** Overridden from EventPane because if a map type has been specified, /**
* we need to attach a listener for the first moveend -- this is how * APIMethod: setMap
* we will know that the map has been centered. Only once the map has * Overridden from EventPane because if a map type has been specified,
* been centered is it safe to change the gmap object's map type. * we need to attach a listener for the first moveend -- this is how
* we will know that the map has been centered. Only once the map has
* been centered is it safe to change the gmap object's map type.
* *
* @param {OpenLayers.Map} map * Parameters:
* map - {<OpenLayers.Map>}
*/ */
setMap: function(map) { setMap: function(map) {
OpenLayers.Layer.EventPane.prototype.setMap.apply(this, arguments); OpenLayers.Layer.EventPane.prototype.setMap.apply(this, arguments);
@@ -90,11 +109,11 @@ OpenLayers.Layer.Google.prototype =
} }
}, },
/** The map has been centered, and a map type was specified, so we /**
* set the map type on the gmap object, then unregister the listener * Method: setMapType
* so that we dont keep doing this every time the map moves. * The map has been centered, and a map type was specified, so we
* * set the map type on the gmap object, then unregister the listener
* @private * so that we dont keep doing this every time the map moves.
*/ */
setMapType: function() { setMapType: function() {
if (this.mapObject.getCenter() != null) { if (this.mapObject.getCenter() != null) {
@@ -104,7 +123,10 @@ OpenLayers.Layer.Google.prototype =
}, },
/** /**
* @param {Event} evt * APIMethod: onMapResize
*
* Parameters:
* evt - {Event}
*/ */
onMapResize: function() { onMapResize: function() {
this.mapObject.checkResize(); this.mapObject.checkResize();
@@ -112,11 +134,14 @@ OpenLayers.Layer.Google.prototype =
/** /**
* @param {OpenLayers.Bounds} bounds * APIMethod: getZoomForExtent
* *
* @returns Corresponding zoom level for a specified Bounds. * Parameters:
* If mapObject is not loaded or not centered, returns null * bounds - {<OpenLayers.Bounds>}
* @type int *
* Return:
* {Integer} Corresponding zoom level for a specified Bounds.
* If mapObject is not loaded or not centered, returns null
* *
getZoomForExtent: function (bounds) { getZoomForExtent: function (bounds) {
var zoom = null; var zoom = null;
@@ -140,12 +165,15 @@ OpenLayers.Layer.Google.prototype =
// //
/** /**
* @param {Object} moBounds * APIMethod: getOLBoundsFromMapObjectBounds
* *
* @returns An OpenLayers.Bounds, translated from the passed-in * Parameters:
* MapObject Bounds * moBounds - {Object}
* Returns null if null value is passed in *
* @type OpenLayers.Bounds * Return:
* {<OpenLayers.Bounds>} An <OpenLayers.Bounds>, translated from the
* passed-in MapObject Bounds.
* Returns null if null value is passed in.
*/ */
getOLBoundsFromMapObjectBounds: function(moBounds) { getOLBoundsFromMapObjectBounds: function(moBounds) {
var olBounds = null; var olBounds = null;
@@ -161,11 +189,14 @@ OpenLayers.Layer.Google.prototype =
}, },
/** /**
* @param {OpenLayers.Bounds} olBounds * APIMethod: getMapObjectBoundsFromOLBounds
* *
* @returns A MapObject Bounds, translated from olBounds * Parameters:
* olBounds - {<OpenLayers.Bounds>}
*
* Return:
* {Object} A MapObject Bounds, translated from olBounds
* Returns null if null value is passed in * Returns null if null value is passed in
* @type Object
*/ */
getMapObjectBoundsFromOLBounds: function(olBounds) { getMapObjectBoundsFromOLBounds: function(olBounds) {
var moBounds = null; var moBounds = null;
@@ -181,12 +212,15 @@ OpenLayers.Layer.Google.prototype =
/** Hack-on function because GMAPS does not give it to us /**
* Method: addContainerPxFunction
* Hack-on function because GMAPS does not give it to us
* *
* @param {GLatLng} gLatLng * Parameters:
* * gLatLng - {GLatLng}
* @returns A GPoint specifying gLatLng translated into "Container" coords *
* @type GPoint * Return:
* {GPoint} A GPoint specifying gLatLng translated into "Container" coords
*/ */
addContainerPxFunction: function() { addContainerPxFunction: function() {
if (typeof GMap2 != "undefined" && !GMap2.fromLatLngToContainerPixel) { if (typeof GMap2 != "undefined" && !GMap2.fromLatLngToContainerPixel) {
@@ -210,9 +244,11 @@ OpenLayers.Layer.Google.prototype =
}, },
/** /**
* @return String with information on why layer is broken, how to get * APIMethod: getWarningHTML
*
* Return:
* {String} String with information on why layer is broken, how to get
* it working. * it working.
* @type String
*/ */
getWarningHTML:function() { getWarningHTML:function() {
@@ -245,26 +281,33 @@ OpenLayers.Layer.Google.prototype =
// Get&Set Center, Zoom // Get&Set Center, Zoom
/** Set the mapObject to the specified center and zoom /**
* APIMethod: setMapObjectCenter
* Set the mapObject to the specified center and zoom
* *
* @param {Object} center MapObject LonLat format * Parameters:
* @param {int} zoom MapObject zoom format * center - {Object} MapObject LonLat format
* zoom - {int} MapObject zoom format
*/ */
setMapObjectCenter: function(center, zoom) { setMapObjectCenter: function(center, zoom) {
this.mapObject.setCenter(center, zoom); this.mapObject.setCenter(center, zoom);
}, },
/** /**
* @returns the mapObject's current center in Map Object format * APIMethod: getMapObjectCenter
* @type Object *
* Return:
* {Object} The mapObject's current center in Map Object format
*/ */
getMapObjectCenter: function() { getMapObjectCenter: function() {
return this.mapObject.getCenter(); return this.mapObject.getCenter();
}, },
/** /**
* @returns the mapObject's current zoom, in Map Object format * APIMethod: getMapObjectZoom
* @type int *
* Return:
* {Integer} The mapObject's current zoom, in Map Object format
*/ */
getMapObjectZoom: function() { getMapObjectZoom: function() {
return this.mapObject.getZoom(); return this.mapObject.getZoom();
@@ -273,21 +316,27 @@ OpenLayers.Layer.Google.prototype =
// LonLat - Pixel Translation // LonLat - Pixel Translation
/** /**
* @param {Object} moPixel MapObject Pixel format * APIMethod: getMapObjectLonLatFromMapObjectPixel
* *
* @returns MapObject LonLat translated from MapObject Pixel * Parameters:
* @type Object * moPixel - {Object} MapObject Pixel format
*
* Return:
* {Object} MapObject LonLat translated from MapObject Pixel
*/ */
getMapObjectLonLatFromMapObjectPixel: function(moPixel) { getMapObjectLonLatFromMapObjectPixel: function(moPixel) {
return this.mapObject.fromContainerPixelToLatLng(moPixel); return this.mapObject.fromContainerPixelToLatLng(moPixel);
}, },
/** /**
* @param {Object} moPixel MapObject Pixel format * APIMethod: getMapObjectPixelFromMapObjectLonLat
* *
* @returns MapObject Pixel translated from MapObject LonLat * Parameters:
* @type Object * moLonLat - {Object} MapObject LonLat format
*
* Return:
* {Object} MapObject Pixel transtlated from MapObject LonLat
*/ */
getMapObjectPixelFromMapObjectLonLat: function(moLonLat) { getMapObjectPixelFromMapObjectLonLat: function(moLonLat) {
return this.mapObject.fromLatLngToContainerPixel(moLonLat); return this.mapObject.fromLatLngToContainerPixel(moLonLat);
@@ -297,10 +346,13 @@ OpenLayers.Layer.Google.prototype =
// Bounds // Bounds
/** /**
* @param {Object} moBounds MapObject Bounds format * APIMethod: getMapObjectZoomFromMapObjectBounds
* *
* @returns MapObject Zoom for specified MapObject Bounds * Parameters:
* @type Object * moBounds - {Object} MapObject Bounds format
*
* Return:
* {Object} MapObject Zoom for specified MapObject Bounds
*/ */
getMapObjectZoomFromMapObjectBounds: function(moBounds) { getMapObjectZoomFromMapObjectBounds: function(moBounds) {
return this.mapObject.getBoundsZoomLevel(moBounds); return this.mapObject.getBoundsZoomLevel(moBounds);
@@ -316,31 +368,40 @@ OpenLayers.Layer.Google.prototype =
// LonLat // LonLat
/** /**
* @param {Object} moLonLat MapObject LonLat format * APIMethod: getLongitudeFromMapObjectLonLat
* *
* @returns Longitude of the given MapObject LonLat * Parameters:
* @type float * moLonLat - {Object} MapObject LonLat format
*
* Return:
* {Float} Longitude of the given MapObject LonLat
*/ */
getLongitudeFromMapObjectLonLat: function(moLonLat) { getLongitudeFromMapObjectLonLat: function(moLonLat) {
return moLonLat.lng(); return moLonLat.lng();
}, },
/** /**
* @param {Object} moLonLat MapObject LonLat format * APIMethod: getLatitudeFromMapObjectLonLat
* *
* @returns Latitude of the given MapObject LonLat * Parameters:
* @type float * moLonLat - {Object} MapObject LonLat format
*
* Return:
* {Float} Latitude of the given MapObject LonLat
*/ */
getLatitudeFromMapObjectLonLat: function(moLonLat) { getLatitudeFromMapObjectLonLat: function(moLonLat) {
return moLonLat.lat(); return moLonLat.lat();
}, },
/** /**
* @param {int} lon float * APIMethod: getMapObjectLonLatFromLonLat
* @param {int} lat float
* *
* @returns MapObject LonLat built from lon and lat params * Parameters:
* @type Object * lon - {Float}
* lat - {Float}
*
* Return:
* {Object} MapObject LonLat built from lon and lat params
*/ */
getMapObjectLonLatFromLonLat: function(lon, lat) { getMapObjectLonLatFromLonLat: function(lon, lat) {
return new GLatLng(lat, lon); return new GLatLng(lat, lon);
@@ -348,32 +409,41 @@ OpenLayers.Layer.Google.prototype =
// Pixel // Pixel
/** /**
* @param {Object} moPixel MapObject Pixel format * APIMethod: getXFromMapObjectPixel
* *
* @returns X value of the MapObject Pixel * Parameters:
* @type int * moPixel - {Object} MapObject Pixel format
*
* Return:
* {Integer} X value of the MapObject Pixel
*/ */
getXFromMapObjectPixel: function(moPixel) { getXFromMapObjectPixel: function(moPixel) {
return moPixel.x; return moPixel.x;
}, },
/** /**
* @param {Object} moPixel MapObject Pixel format * APIMethod: getYFromMapObjectPixel
* *
* @returns Y value of the MapObject Pixel * Parameters:
* @type int * moPixel - {Object} MapObject Pixel format
*
* Return:
* {Integer} Y value of the MapObject Pixel
*/ */
getYFromMapObjectPixel: function(moPixel) { getYFromMapObjectPixel: function(moPixel) {
return moPixel.y; return moPixel.y;
}, },
/** /**
* @param {int} x * APIMethod: getMapObjectPixelFromXY
* @param {int} y
* *
* @returns MapObject Pixel from x and y parameters * Parameters:
* @type Object * x - {Integer}
* y - {Integer}
*
* Return:
* {Object} MapObject Pixel from x and y parameters
*/ */
getMapObjectPixelFromXY: function(x, y) { getMapObjectPixelFromXY: function(x, y) {
return new GPoint(x, y); return new GPoint(x, y);
+87 -50
View File
@@ -4,32 +4,46 @@
/** /**
* @class
*
* @requires OpenLayers/Layer/HTTPRequest.js * @requires OpenLayers/Layer/HTTPRequest.js
*
* Class: OpenLayers.Layer.Grid
* Base class for layers that use a lattice of tiles. Create a new grid
* layer with the <OpenLayers.Layer.Grid> constructor.
*
* Inherits from:
* - <OpenLayers.Layer.HTTPRequest>
*/ */
OpenLayers.Layer.Grid = OpenLayers.Class.create(); OpenLayers.Layer.Grid = OpenLayers.Class.create();
OpenLayers.Layer.Grid.prototype = OpenLayers.Layer.Grid.prototype =
OpenLayers.Class.inherit( OpenLayers.Layer.HTTPRequest, { OpenLayers.Class.inherit( OpenLayers.Layer.HTTPRequest, {
/** @type OpenLayers.Size */ /**
* APIProperty: tileSize
* {<OpenLayers.Size>}
*/
tileSize: null, tileSize: null,
/** this is an array of rows, each row is an array of tiles /**
* * Property: grid
* @type Array(Array) */ * {Array} This is an array of rows, each row is an array of tiles
*/
grid: null, grid: null,
/** @type Integer */ /**
* APIProperty: buffer
* {Integer}
*/
buffer: 2, buffer: 2,
/** /**
* @constructor * Constructor: OpenLayers.Layer.Grid
* * Create a new grid layer
* @param {String} name *
* @param {String} url * Parameters:
* @param {Object} params * name - {String}
* @param {Object} options Hashtable of extra options to tag onto the layer * url - {String}
* params - {Object}
* options - {Object} Hashtable of extra options to tag onto the layer
*/ */
initialize: function(name, url, params, options) { initialize: function(name, url, params, options) {
OpenLayers.Layer.HTTPRequest.prototype.initialize.apply(this, OpenLayers.Layer.HTTPRequest.prototype.initialize.apply(this,
@@ -37,8 +51,9 @@ OpenLayers.Layer.Grid.prototype =
this.grid = new Array(); this.grid = new Array();
}, },
/** on destroy, clear the grid. /**
* * APIMethod: destroy
* Deconstruct the layer and clear the grid.
*/ */
destroy: function() { destroy: function() {
this.clearGrid(); this.clearGrid();
@@ -47,10 +62,10 @@ OpenLayers.Layer.Grid.prototype =
OpenLayers.Layer.HTTPRequest.prototype.destroy.apply(this, arguments); OpenLayers.Layer.HTTPRequest.prototype.destroy.apply(this, arguments);
}, },
/** go through and remove all tiles from the grid, calling /**
* Method: clearGrid
* Go through and remove all tiles from the grid, calling
* destroy() on each of them to kill circular references * destroy() on each of them to kill circular references
*
* @private
*/ */
clearGrid:function() { clearGrid:function() {
if (this.grid) { if (this.grid) {
@@ -65,10 +80,14 @@ OpenLayers.Layer.Grid.prototype =
}, },
/** /**
* @param {Object} obj * APIMethod: clone
* Create a clone of this layer
*
* Parameters:
* obj - {Object} Is this ever used?
* *
* @returns An exact clone of this OpenLayers.Layer.Grid * Return:
* @type OpenLayers.Layer.Grid * {<OpenLayers.Layer.Grid>} An exact clone of this OpenLayers.Layer.Grid
*/ */
clone: function (obj) { clone: function (obj) {
@@ -93,10 +112,13 @@ OpenLayers.Layer.Grid.prototype =
return obj; return obj;
}, },
/** When the layer is added to a map, then we can ask the map for /**
* Method: setMap
* When the layer is added to a map, then we can ask the map for
* its default tile size * its default tile size
* *
* @param {OpenLayers.Map} map * Parameters:
* map - {<OpenLayers.Map>}
*/ */
setMap: function(map) { setMap: function(map) {
OpenLayers.Layer.HTTPRequest.prototype.setMap.apply(this, arguments); OpenLayers.Layer.HTTPRequest.prototype.setMap.apply(this, arguments);
@@ -105,13 +127,16 @@ OpenLayers.Layer.Grid.prototype =
} }
}, },
/** This function is called whenever the map is moved. All the moving /**
* Method: moveTo
* This function is called whenever the map is moved. All the moving
* of actual 'tiles' is done by the map, but moveTo's role is to accept * of actual 'tiles' is done by the map, but moveTo's role is to accept
* a bounds and make sure the data that that bounds requires is pre-loaded. * a bounds and make sure the data that that bounds requires is pre-loaded.
* *
* @param {OpenLayers.Bounds} bounds * Parameters:
* @param {Boolean} zoomChanged * bounds - {<OpenLayers.Bounds>}
* @param {Boolean} dragging * zoomChanged - {Boolean}
* dragging - {Boolean}
*/ */
moveTo:function(bounds, zoomChanged, dragging) { moveTo:function(bounds, zoomChanged, dragging) {
OpenLayers.Layer.HTTPRequest.prototype.moveTo.apply(this, arguments); OpenLayers.Layer.HTTPRequest.prototype.moveTo.apply(this, arguments);
@@ -157,12 +182,13 @@ OpenLayers.Layer.Grid.prototype =
}, },
/** /**
* @private * Method: getGridBounds
* Get the bounds of the grid
* *
* @returns A Bounds object representing the bounds of all the currently * Return:
* loaded tiles (including those partially or not at all seen * {<OpenLayers.Bounds>} A Bounds object representing the bounds of all the
* onscreen) * currently loaded tiles (including those partially or not at all seen
* @type OpenLayers.Bounds * onscreen)
*/ */
getGridBounds:function() { getGridBounds:function() {
@@ -179,7 +205,8 @@ OpenLayers.Layer.Grid.prototype =
}, },
/** /**
* @private * Method: _initTiles
* Initialize the tiles
*/ */
_initTiles:function() { _initTiles:function() {
@@ -280,9 +307,8 @@ OpenLayers.Layer.Grid.prototype =
this.spiralTileLoad(); this.spiralTileLoad();
}, },
/** /**
* @private * Method: spiralTileLoad
*
* Starts at the top right corner of the grid and proceeds in a spiral * Starts at the top right corner of the grid and proceeds in a spiral
* towards the center, adding tiles one at a time to the beginning of a * towards the center, adding tiles one at a time to the beginning of a
* queue. * queue.
@@ -355,23 +381,27 @@ OpenLayers.Layer.Grid.prototype =
}, },
/** /**
* addTile gives subclasses of Grid the opportunity to create an * APIMethod: addTile
* Gives subclasses of Grid the opportunity to create an
* OpenLayer.Tile of their choosing. The implementer should initialize * OpenLayer.Tile of their choosing. The implementer should initialize
* the new tile and take whatever steps necessary to display it. * the new tile and take whatever steps necessary to display it.
* *
* @param {OpenLayers.Bounds} bounds * Parameters
* bounds - {<OpenLayers.Bounds>}
* *
* @returns The added OpenLayers.Tile * Return:
* @type OpenLayers.Tile * {<OpenLayers.Tile>} The added OpenLayers.Tile
*/ */
addTile:function(bounds, position) { addTile:function(bounds, position) {
// Should be implemented by subclasses // Should be implemented by subclasses
}, },
/** /**
* APIMethod: mergeNewParams
* Once params have been changed, we will need to re-init our tiles * Once params have been changed, we will need to re-init our tiles
* *
* @param {Object} newParams Hashtable of new params to use * Parameters:
* newParams - {Object} Hashtable of new params to use
*/ */
mergeNewParams:function(newArguments) { mergeNewParams:function(newArguments) {
OpenLayers.Layer.HTTPRequest.prototype.mergeNewParams.apply(this, OpenLayers.Layer.HTTPRequest.prototype.mergeNewParams.apply(this,
@@ -384,9 +414,11 @@ OpenLayers.Layer.Grid.prototype =
/** /**
* @private * Method: shiftRow
* * Shifty grid work
* @param {Boolean} prepend if true, prepend to beginning. *
* Parameters:
* prepend - {Boolean} if true, prepend to beginning.
* if false, then append to end * if false, then append to end
*/ */
shiftRow:function(prepend) { shiftRow:function(prepend) {
@@ -417,9 +449,11 @@ OpenLayers.Layer.Grid.prototype =
}, },
/** /**
* @private * Method: shiftColumn
* * Shift grid work in the other dimension
* @param {Boolean} prepend if true, prepend to beginning. *
* Parameters:
* prepend - {Boolean} if true, prepend to beginning.
* if false, then append to end * if false, then append to end
*/ */
shiftColumn: function(prepend) { shiftColumn: function(prepend) {
@@ -448,6 +482,9 @@ OpenLayers.Layer.Grid.prototype =
} }
}, },
/** @final @type String */ /**
* Constant: CLASS_NAME
* {String} Name of this class
*/
CLASS_NAME: "OpenLayers.Layer.Grid" CLASS_NAME: "OpenLayers.Layer.Grid"
}); });
+65 -44
View File
@@ -4,47 +4,54 @@
/** /**
* @class
*
* @requires OpenLayers/Layer.js * @requires OpenLayers/Layer.js
*
* Class: OpenLayers.Layer.HTTPRequest
*
* Inherits:
* - OpenLayers.Layer
*/ */
OpenLayers.Layer.HTTPRequest = OpenLayers.Class.create(); OpenLayers.Layer.HTTPRequest = OpenLayers.Class.create();
OpenLayers.Layer.HTTPRequest.prototype = OpenLayers.Layer.HTTPRequest.prototype =
OpenLayers.Class.inherit( OpenLayers.Layer, { OpenLayers.Class.inherit( OpenLayers.Layer, {
/** Used to hash URL param strings for multi-WMS server selection. /**
* Set to the Golden Ratio per Knuth's recommendation. * Constant: URL_HASH_FACTOR
* * {Float} Used to hash URL param strings for multi-WMS server selection.
* @final @type Numeric * Set to the Golden Ratio per Knuth's recommendation.
*/ */
URL_HASH_FACTOR: (Math.sqrt(5) - 1) / 2, URL_HASH_FACTOR: (Math.sqrt(5) - 1) / 2,
/** This is either an array of url strings or a single url string. /**
* * Property: url
* @type Array(String) or String */ * {Array(String) or String} This is either an array of url strings or
* a single url string.
*/
url: null, url: null,
/** Hashtable of key/value parameters /**
* * Property: params
* @type Object */ * {Object} Hashtable of key/value parameters
*/
params: null, params: null,
/** Whether layer should reproject itself based on base layer locations. /**
* This allows reprojection onto commercial layers. Default is false: * APIProperty: reproject
* Most layers can't reproject, but layers which can create non-square * {Boolean} Whether layer should reproject itself based on base layer
* geographic pixels can, like WMS. * locations. This allows reprojection onto commercial layers.
* * Default is false: Most layers can't reproject, but layers
* @type Boolean * which can create non-square geographic pixels can, like WMS.
*/ */
reproject: false, reproject: false,
/** /**
* @constructor * Constructor: OpenLayers.Layer.HTTPRequest
* *
* @param {String} name * Parameters:
* @param {Array(String) or String} url * name - {String}
* @param {Object} params * url - {Array(String) or String}
* @param {Object} options Hashtable of extra options to tag onto the layer * params - {Object}
* options - {Object} Hashtable of extra options to tag onto the layer
*/ */
initialize: function(name, url, params, options) { initialize: function(name, url, params, options) {
var newArguments = arguments; var newArguments = arguments;
@@ -55,7 +62,7 @@ OpenLayers.Layer.HTTPRequest.prototype =
}, },
/** /**
* * APIMethod: destroy
*/ */
destroy: function() { destroy: function() {
this.url = null; this.url = null;
@@ -64,10 +71,14 @@ OpenLayers.Layer.HTTPRequest.prototype =
}, },
/** /**
* @param {Object} obj * APIMethod: clone
* *
* @returns An exact clone of this OpenLayers.Layer.HTTPRequest * Parameters:
* @type OpenLayers.Layer.HTTPRequest * obj - {Object}
*
* Return:
* {<OpenLayers.Layer.HTTPRequest>} An exact clone of this
* <OpenLayers.Layer.HTTPRequest>
*/ */
clone: function (obj) { clone: function (obj) {
@@ -87,33 +98,40 @@ OpenLayers.Layer.HTTPRequest.prototype =
}, },
/** /**
* @param {String} newUrl * APIMethod: setUrl
*
* Parameters:
* newUrl - {String}
*/ */
setUrl: function(newUrl) { setUrl: function(newUrl) {
this.url = newUrl; this.url = newUrl;
}, },
/** /**
* @param {Object} newParams * APIMethod: mergeNewParams
*
* Parameters:
* newParams - {Object}
*/ */
mergeNewParams:function(newParams) { mergeNewParams:function(newParams) {
this.params = OpenLayers.Util.extend(this.params, newParams); this.params = OpenLayers.Util.extend(this.params, newParams);
}, },
/** /**
* Method: selectUrl
* selectUrl() implements the standard floating-point multiplicative * selectUrl() implements the standard floating-point multiplicative
* hash function described by Knuth, and hashes the contents of the * hash function described by Knuth, and hashes the contents of the
* given param string into a float between 0 and 1. This float is then * given param string into a float between 0 and 1. This float is then
* scaled to the size of the provided urls array, and used to select * scaled to the size of the provided urls array, and used to select
* a URL. * a URL.
* *
* @param {String} paramString * Parameters:
* @param {Array(String)} urls * paramString - {String}
* * urls - {Array(String)}
* @returns An entry from the urls array, deterministically selected based
* on the paramString.
* @type String
* *
* Return:
* {String} An entry from the urls array, deterministically selected based
* on the paramString.
*/ */
selectUrl: function(paramString, urls) { selectUrl: function(paramString, urls) {
var product = 1; var product = 1;
@@ -124,7 +142,9 @@ OpenLayers.Layer.HTTPRequest.prototype =
return urls[Math.floor(product * urls.length)]; return urls[Math.floor(product * urls.length)];
}, },
/** combine url with layer's params and these newParams. /**
* Method: getFullRequestString
* Combine url with layer's params and these newParams.
* *
* does checking on the serverPath variable, allowing for cases when it * does checking on the serverPath variable, allowing for cases when it
* is supplied with trailing ? or &, as well as cases where not. * is supplied with trailing ? or &, as well as cases where not.
@@ -134,11 +154,12 @@ OpenLayers.Layer.HTTPRequest.prototype =
* *
* WARNING: The altUrl parameter is deprecated and will be removed in 3.0. * WARNING: The altUrl parameter is deprecated and will be removed in 3.0.
* *
* @param {Object} newParams * Parameters:
* @param {String} altUrl Use this as the url instead of the layer's url * newParams - {Object}
* altUrl - {String} Use this as the url instead of the layer's url
* *
* * Return:
* @type String * {String}
*/ */
getFullRequestString:function(newParams, altUrl) { getFullRequestString:function(newParams, altUrl) {
+72 -42
View File
@@ -3,57 +3,67 @@
* for the full text of the license. */ * for the full text of the license. */
/** /**
* @fileoverview Image Layer
* @author Tim Schaub
*/
/**
* @class
*
* @requires OpenLayers/Layer.js * @requires OpenLayers/Layer.js
* @requires OpenLayers/Tile/Image.js * @requires OpenLayers/Tile/Image.js
*
* Class: OpenLayers.Layer.Image
* Instances of OpenLayers.Layer.Image are used to display data from a web
* accessible image as a map layer. Create a new image layer with the
* <OpenLayers.Layer.Image> constructor. Inherits from <OpenLayers.Layer>.
*/ */
OpenLayers.Layer.Image = OpenLayers.Class.create(); OpenLayers.Layer.Image = OpenLayers.Class.create();
OpenLayers.Layer.Image.prototype = OpenLayers.Layer.Image.prototype =
OpenLayers.Class.inherit(OpenLayers.Layer, { OpenLayers.Class.inherit(OpenLayers.Layer, {
/** By default, Layer.Image will be a baselayer /**
* * Property: isBaseLayer
* @type Boolean */ * {Boolean} The layer is a base layer. Default is true. Set this property
* in the layer options
*/
isBaseLayer: true, isBaseLayer: true,
/** @type String */ /**
* Property: url
* {String} URL of the image to use
*/
url: null, url: null,
/** /**
* The image bounds in map units * Property: extent
* @type OpenLayers.Bounds * {<OpenLayers.Bounds>} The image bounds in map units
*/ */
extent: null, extent: null,
/** /**
* The image size in pixels * Property: size
* @type OpenLayers.Size * {<OpenLayers.Size>} The image size in pixels
*/ */
size: null, size: null,
/** @type OpenLayers.Tile.Image */ /**
* Property: tile
* {<OpenLayers.Tile.Image>}
*/
tile: null, tile: null,
/** /**
* The ratio of height/width represented by a single pixel in the graphic * Property: aspectRatio
* @type Float */ * {Float} The ratio of height/width represented by a single pixel in the
* graphic
*/
aspectRatio: null, aspectRatio: null,
/** /**
* @constructor * Constructor: OpenLayers.Layer.Image
* * Create a new image layer
* @param {String} name *
* @param {String} url Relative or absolute path to the image * Parameters:
* @param {OpenLayers.Bounds} extent The extent represented by the image * name - {String} A name for the layer.
* @param {OpenLayers.Size} size The size (in pixels) of the image * url - {String} Relative or absolute path to the image
* @param {Object} options Hashtable of extra options to tag onto the layer * extent - {<OpenLayers.Bounds>} The extent represented by the image
*/ * size - {<OpenLayers.Size>} The size (in pixels) of the image
* options - {Object} Hashtable of extra options to tag onto the layer
*/
initialize: function(name, url, extent, size, options) { initialize: function(name, url, extent, size, options) {
this.url = url; this.url = url;
this.extent = extent; this.extent = extent;
@@ -65,7 +75,8 @@ OpenLayers.Layer.Image.prototype =
}, },
/** /**
* * Method: destroy
* Destroy this layer
*/ */
destroy: function() { destroy: function() {
if (this.tile) { if (this.tile) {
@@ -76,10 +87,14 @@ OpenLayers.Layer.Image.prototype =
}, },
/** /**
* @param {Object} obj * Method: clone
* * Create a clone of this layer
* @returns An exact clone of this OpenLayers.Layer.Image *
* @type OpenLayers.Layer.Image * Paramters:
* obj - {Object} An optional layer (is this ever used?)
*
* Return:
* {<OpenLayers.Layer.Image>} An exact copy of this layer
*/ */
clone: function(obj) { clone: function(obj) {
@@ -100,7 +115,10 @@ OpenLayers.Layer.Image.prototype =
}, },
/** /**
* @param {OpenLayers.Map} map * APIMethod: setMap
*
* Parameters:
* map - {<OpenLayers.Map>}
*/ */
setMap: function(map) { setMap: function(map) {
/** /**
@@ -117,11 +135,14 @@ OpenLayers.Layer.Image.prototype =
OpenLayers.Layer.prototype.setMap.apply(this, arguments); OpenLayers.Layer.prototype.setMap.apply(this, arguments);
}, },
/** Create the tile for the image or resize it for the new resolution /**
* Method: moveTo
* Create the tile for the image or resize it for the new resolution
* *
* @param {OpenLayers.Bounds} bounds * Parameters:
* @param {Boolean} zoomChanged * bounds - {<OpenLayers.Bounds>}
* @param {Boolean} dragging * zoomChanged - {Boolean}
* dragging - {Boolean}
*/ */
moveTo:function(bounds, zoomChanged, dragging) { moveTo:function(bounds, zoomChanged, dragging) {
OpenLayers.Layer.prototype.moveTo.apply(this, arguments); OpenLayers.Layer.prototype.moveTo.apply(this, arguments);
@@ -163,23 +184,32 @@ OpenLayers.Layer.Image.prototype =
}, },
/** /**
* @param {String} newUrl * APIMethod: setUrl
*
* Parameters:
* newUrl - {String}
*/ */
setUrl: function(newUrl) { setUrl: function(newUrl) {
this.url = newUrl; this.url = newUrl;
this.draw(); this.draw();
}, },
/** The url we return is always the same (the image itself never changes) /**
* so we can ignore the bounds parameter (it will always be the same, * APIMethod: getURL
* anyways) * The url we return is always the same (the image itself never changes)
* so we can ignore the bounds parameter (it will always be the same,
* anyways)
* *
* @param {OpenLayers.Bounds} bounds * Parameters:
* bounds - {<OpenLayers.Bounds>}
*/ */
getURL: function(bounds) { getURL: function(bounds) {
return this.url; return this.url;
}, },
/** @final @type String */ /**
* Constant: CLASS_NAME
* {String} OpenLayers.Layer.Image
*/
CLASS_NAME: "OpenLayers.Layer.Image" CLASS_NAME: "OpenLayers.Layer.Image"
}); });
+59 -17
View File
@@ -4,29 +4,53 @@
/** /**
* @class
*
* @requires OpenLayers/Layer/Grid.js * @requires OpenLayers/Layer/Grid.js
*
* Class: OpenLayers.Layer.KaMap
*
* Inherits:
* - <OpenLayers.Layer.Grid>
*/ */
OpenLayers.Layer.KaMap = OpenLayers.Class.create(); OpenLayers.Layer.KaMap = OpenLayers.Class.create();
OpenLayers.Layer.KaMap.prototype = OpenLayers.Layer.KaMap.prototype =
OpenLayers.Class.inherit( OpenLayers.Layer.Grid, { OpenLayers.Class.inherit( OpenLayers.Layer.Grid, {
/** KaMap Layer is always a base layer /**
* * APIProperty: isBaseLayer
* @type Boolean * {Boolean} KaMap Layer is always a base layer
*/ */
isBaseLayer: true, isBaseLayer: true,
/**
* APIProperty: units
* {?}
*/
units: null, units: null,
/**
* APIProperty: resolution
* {Float}
*/
resolution: OpenLayers.DOTS_PER_INCH, resolution: OpenLayers.DOTS_PER_INCH,
/**
* Constant: DEFAULT_PARAMS
* {Object}
*/
DEFAULT_PARAMS: { DEFAULT_PARAMS: {
i: 'jpeg', i: 'jpeg',
map: '' map: ''
}, },
/**
* Constructor: OpenLayers.Layer.KaMap
*
* Parameters:
* name - {String}
* url - {String}
* params - {Object}
* options - {Object}
*/
initialize: function(name, url, params, options) { initialize: function(name, url, params, options) {
var newArguments = new Array(); var newArguments = new Array();
newArguments.push(name, url, params, options); newArguments.push(name, url, params, options);
@@ -41,12 +65,15 @@ OpenLayers.Layer.KaMap.prototype =
}, },
/** /**
* @param {OpenLayers.Bounds} bounds * Method: getURL
* *
* @returns A string with the layer's url and parameters and also the * Parameters:
* passed-in bounds and appropriate tile size specified as * bounds - {<OpenLayers.Bounds>}
* parameters *
* @type String * Return:
* {String} A string with the layer's url and parameters and also the
* passed-in bounds and appropriate tile size specified as
* parameters
*/ */
getURL: function (bounds) { getURL: function (bounds) {
bounds = this.adjustBounds(bounds); bounds = this.adjustBounds(bounds);
@@ -60,13 +87,26 @@ OpenLayers.Layer.KaMap.prototype =
s: scale s: scale
}); });
}, },
/**
* Method: addTile
*
* Parameters:
* bounds - {<OpenLayers.Bounds>}
* position - {<OpenLayers.Pixel>}
*
* Return:
* {<OpenLayers.Tile.Image>}
*/
addTile:function(bounds,position) { addTile:function(bounds,position) {
var url = this.getURL(bounds); var url = this.getURL(bounds);
return new OpenLayers.Tile.Image(this, position, bounds, return new OpenLayers.Tile.Image(this, position, bounds,
url, this.tileSize); url, this.tileSize);
}, },
/**
* Method: _initTiles
*/
_initTiles:function() { _initTiles:function() {
var viewSize = this.map.getSize(); var viewSize = this.map.getSize();
@@ -148,10 +188,13 @@ OpenLayers.Layer.KaMap.prototype =
}, },
/** /**
* @param {Object} obj * APIMethod: clone
* *
* @returns An exact clone of this OpenLayers.Layer.Grid * Parameters:
* @type OpenLayers.Layer.Grid * obj - {Object}
*
* Return:
* {<OpenLayers.Layer.Kamap>} An exact clone of this OpenLayers.Layer.KaMap
*/ */
clone: function (obj) { clone: function (obj) {
@@ -176,7 +219,6 @@ OpenLayers.Layer.KaMap.prototype =
return obj; return obj;
}, },
/** @final @type String */ /** @final @type String */
CLASS_NAME: "OpenLayers.Layer.KaMap" CLASS_NAME: "OpenLayers.Layer.KaMap"
}); });
+70 -35
View File
@@ -3,26 +3,50 @@
* for the full text of the license. */ * for the full text of the license. */
// @requires OpenLayers/Layer/Grid.js // @requires OpenLayers/Layer/Grid.js
/** /**
* @class
* @requires OpenLayers/Layer/Grid.js * @requires OpenLayers/Layer/Grid.js
*/ *
* Class: OpenLayers.Layer.MapServer
* Instances of OpenLayers.Layer.MapServer are used to display
* data from a MapServer CGI instance.
*
* Inherits from:
* - <OpenLayers.Layer.Grid>
*/
OpenLayers.Layer.MapServer = OpenLayers.Class.create(); OpenLayers.Layer.MapServer = OpenLayers.Class.create();
OpenLayers.Layer.MapServer.prototype = OpenLayers.Layer.MapServer.prototype =
OpenLayers.Class.inherit( OpenLayers.Layer.Grid, { OpenLayers.Class.inherit( OpenLayers.Layer.Grid, {
/** @final @type hash */ /**
* Constant: DEFAULT_PARAMS
* {Object} Hashtable of default parameter key/value pairs
*/
DEFAULT_PARAMS: { DEFAULT_PARAMS: {
mode: "map", mode: "map",
map_imagetype: "png" map_imagetype: "png"
}, },
/** /**
* @constructor * Constructor: OpenLayers.Layer.MapServer
* * Create a new MapServer layer object
* @param {str} name *
* @param {str} url * Example:
* @param {hash} params * (code)
*/ * layer = new OpenLayers.Layer.MapServer( "OpenLayers WMS",
* "http://labs.metacarta.com/wms/vmap0", {layers: 'basic'},
* {gutter: 15});
* (end)
*
* Parameters:
* name - {String} A name for the layer
* url - {String} Base url for the MapServer CGI
* (e.g. http://www2.dmsolutions.ca/cgi-bin/mapserv)
* params - {Object} An object with key/value pairs representing the
* GetMap query string parameters and parameter values.
* options - {Ojbect} Hashtable of extra options to tag onto the layer
*
* Return:
* A new OpenLayers.Layer.MapServer instance
*/
initialize: function(name, url, params, options) { initialize: function(name, url, params, options) {
var newArguments = new Array(); var newArguments = new Array();
newArguments.push(name, url, params, options); newArguments.push(name, url, params, options);
@@ -44,11 +68,12 @@ OpenLayers.Layer.MapServer.prototype =
}, },
/** /**
* @param {Object} obj * Method: clone
* * Create a clone of this layer
* @returns A clone of this OpenLayers.Layer.MapServer *
* @type OpenLayers.Layer.MapServer * Return:
*/ * {<OpenLayers.Layer.MapServer>} An exact clone of this layer
*/
clone: function (obj) { clone: function (obj) {
if (obj == null) { if (obj == null) {
obj = new OpenLayers.Layer.MapServer(this.name, obj = new OpenLayers.Layer.MapServer(this.name,
@@ -65,10 +90,10 @@ OpenLayers.Layer.MapServer.prototype =
}, },
/** /**
* addTile creates a tile, initializes it (via 'draw' in this case), and * addTile creates a tile, initializes it, and
* adds it to the layer div. * adds it to the layer div.
* *
* @param {OpenLayers.Bounds} bounds * @param {<OpenLayers.Bounds>} bounds
* *
* @returns The added OpenLayers.Tile.Image * @returns The added OpenLayers.Tile.Image
* @type OpenLayers.Tile.Image * @type OpenLayers.Tile.Image
@@ -79,12 +104,16 @@ OpenLayers.Layer.MapServer.prototype =
}, },
/** /**
* @param {OpenLayers.Bounds} bounds * Method: getURL
* * Return a query string for this layer
* @returns A string with the layer's url and parameters and also the *
* passed-in bounds and appropriate tile size specified as * Parameters:
* parameters * bounds - {<OpenLayers.Bounds>} A bounds representing the bbox for the
* @type String * request
*
* Return:
* {String} A string with the layer's url and parameters and also the
* passed-in bounds and appropriate tile size specified as parameters
*/ */
getURL: function (bounds) { getURL: function (bounds) {
bounds = this.adjustBounds(bounds); bounds = this.adjustBounds(bounds);
@@ -105,17 +134,20 @@ OpenLayers.Layer.MapServer.prototype =
}, },
/** /**
* getFullRequestString on MapServer layers is special, because we * Method: getFullRequestString
* do a regular expression replace on ',' in parameters to '+'. * combine the layer's url with its params and these newParams.
* This is why it is subclassed here. *
* * Parameter: {Object} newParams
* @param {Object} newParams Parameters to add to the default parameters * new parameters that should be added to the request string.
* for the layer. *
* @param {String} altUrl Alternative base URL to use. * Parameter: {String} altUrl
*/ * optional, replace the URL in the full request string with the
* provided URL.
*
* Return: {String}
* A string with the layer's url and parameters embedded in it.
*/
getFullRequestString:function(newParams, altUrl) { getFullRequestString:function(newParams, altUrl) {
// use layer's url unless altUrl passed in // use layer's url unless altUrl passed in
var url = (altUrl == null) ? this.url : altUrl; var url = (altUrl == null) ? this.url : altUrl;
@@ -166,6 +198,9 @@ OpenLayers.Layer.MapServer.prototype =
} }
return requestString; return requestString;
}, },
/** @final @type String */ /**
* Constant: CLASS_NAME
* {String} OpenLayers.Layer.MapServer
*/
CLASS_NAME: "OpenLayers.Layer.MapServer" CLASS_NAME: "OpenLayers.Layer.MapServer"
}); });
+77 -37
View File
@@ -2,44 +2,60 @@
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */
/* Derived from the WMS/Untiled.js script by Stephen Woodbridge, 2007 */
/** /**
* @class
*
* @requires OpenLayers/Layer/HTTPRequest.js * @requires OpenLayers/Layer/HTTPRequest.js
* @requires OpenLayers/Layer/MapServer.js * @requires OpenLayers/Layer/MapServer.js
*
* Class: OpenLayers.Layer.MapServer.Untiled
*
* Inherits from:
* - <OpenLayers.Layer.HTTPRequest>
*/ */
OpenLayers.Layer.MapServer.Untiled = OpenLayers.Class.create(); OpenLayers.Layer.MapServer.Untiled = OpenLayers.Class.create();
OpenLayers.Layer.MapServer.Untiled.prototype = OpenLayers.Layer.MapServer.Untiled.prototype =
OpenLayers.Class.inherit( OpenLayers.Layer.HTTPRequest, { OpenLayers.Class.inherit( OpenLayers.Layer.HTTPRequest, {
/** Hashtable of default parameter key/value pairs /**
* @final @type Object */ * Constant: default_params
* Hashtable of default parameter key/value pairs
*/
default_params: { default_params: {
mode: "map", mode: "map",
map_imagetype: "png" map_imagetype: "png"
}, },
/**
* APIProperty: reproject
* {Boolean} 'stretch' tiles according to base layer.
*/
reproject: true, reproject: true,
/** the ratio of image/tile size to map size (this is the untiled buffer) /**
* @type int */ * APIProperty: ratio
* {Float} the ratio of image/tile size to map size (this is the untiled
* buffer)
*/
ratio: 1, ratio: 1,
/** @type OpenLayers.Tile.Image */ /**
* Property: tile
* {<OpenLayers.Tile.Image>}
*/
tile: null, tile: null,
/** did the image finish loading before a new draw was initiated? /**
* @type Boolean */ * Propety: doneLoading
* {Boolean} did the image finish loading before a new draw was initiated?
*/
doneLoading: false, doneLoading: false,
/** /**
* @constructor * Constructor: OpenLayers.Layer.MapServer.Untiled
* *
* @param {String} name * Parameters:
* @param {String} url * name - {String}
* @param {Object} params * url - {String}
* params - {Object}
*/ */
initialize: function(name, url, params, options) { initialize: function(name, url, params, options) {
var newArguments = []; var newArguments = [];
@@ -60,7 +76,7 @@ OpenLayers.Layer.MapServer.Untiled.prototype =
}, },
/** /**
* * APIMethod: destroy
*/ */
destroy: function() { destroy: function() {
if (this.tile) { if (this.tile) {
@@ -71,10 +87,12 @@ OpenLayers.Layer.MapServer.Untiled.prototype =
}, },
/** /**
* @param {Object} obj * APIMethod: clone
* obj - {Object}
* *
* @returns An exact clone of this OpenLayers.Layer.MapServer.Untiled * Returns:
* @type OpenLayers.Layer.MapServer.Untiled * {<OpenLayers.Layer.MapServer.Untiled>} An exact clone of this
* OpenLayers.Layer.MapServer.Untiled
*/ */
clone: function (obj) { clone: function (obj) {
@@ -94,15 +112,19 @@ OpenLayers.Layer.MapServer.Untiled.prototype =
}, },
/** Once HTTPRequest has set the map, we can load the image div /**
* Method: setMap
* Once HTTPRequest has set the map, we can load the image div
* *
* @param {OpenLayers.Map} map * Parameters:
* map - {<OpenLayers.Map>}
*/ */
setMap: function(map) { setMap: function(map) {
OpenLayers.Layer.HTTPRequest.prototype.setMap.apply(this, arguments); OpenLayers.Layer.HTTPRequest.prototype.setMap.apply(this, arguments);
}, },
/** /**
* Method: setTileSize
* Set the tile size based on the map size. This also sets layer.imageSize * Set the tile size based on the map size. This also sets layer.imageSize
* and layer.imageOffset for use by Tile.Image. * and layer.imageOffset for use by Tile.Image.
*/ */
@@ -115,12 +137,15 @@ OpenLayers.Layer.MapServer.Untiled.prototype =
this.imageOffset = new OpenLayers.Pixel(0, 0); this.imageOffset = new OpenLayers.Pixel(0, 0);
}, },
/** When it is not a dragging move (ie when done dragging) /**
* Method: moveTo
* When it is not a dragging move (ie when done dragging)
* reload and recenter the div. * reload and recenter the div.
* *
* @param {OpenLayers.Bounds} bounds * Parameters:
* @param {Boolean} zoomChanged * bounds - {<OpenLayers.Bounds>}
* @param {Boolean} dragging * zoomChanged - {Boolean}
* dragging - {Boolean}
*/ */
moveTo:function(bounds, zoomChanged, dragging) { moveTo:function(bounds, zoomChanged, dragging) {
if (!this.doneLoading) { if (!this.doneLoading) {
@@ -190,7 +215,13 @@ OpenLayers.Layer.MapServer.Untiled.prototype =
} }
}, },
/**
* Method: getURL
*
* Parameters:
* bounds - {<OpenLayers.Bounds>}
*/
getURL: function(bounds) { getURL: function(bounds) {
var url = this.getFullRequestString( var url = this.getFullRequestString(
{mapext:bounds.toBBOX().replace(/,/g," "), {mapext:bounds.toBBOX().replace(/,/g," "),
@@ -204,16 +235,24 @@ OpenLayers.Layer.MapServer.Untiled.prototype =
}, },
/** Once HTTPRequest has updated the url, reload the image div /**
* @param {String} newUrl * APIMehod: setUrl
* Once HTTPRequest has updated the url, reload the image div
*
* Parameters:
* newUrl - {String}
*/ */
setUrl: function(newUrl) { setUrl: function(newUrl) {
OpenLayers.Layer.HTTPRequest.prototype.setUrl.apply(this, arguments); OpenLayers.Layer.HTTPRequest.prototype.setUrl.apply(this, arguments);
this.moveTo(); this.moveTo();
}, },
/** Once HTTPRequest has updated new params, reload the image div /**
* @param {Object} newParams * APIMethod: mergeNewParams
* Once HTTPRequest has updated new params, reload the image div
*
* Parameters:
* newParams - {Object}
*/ */
mergeNewParams:function(newParams) { mergeNewParams:function(newParams) {
OpenLayers.Layer.HTTPRequest.prototype.mergeNewParams.apply(this, OpenLayers.Layer.HTTPRequest.prototype.mergeNewParams.apply(this,
@@ -222,15 +261,16 @@ OpenLayers.Layer.MapServer.Untiled.prototype =
this.moveTo(null, true); this.moveTo(null, true);
}, },
/** combine the layer's url with its params and these newParams. /**
* APIMethod: getFullRequestString
* combine the layer's url with its params and these newParams.
* *
* Add the SRS parameter from 'projection' -- this is probably * Add the SRS parameter from 'projection' -- this is probably
* more eloquently done via a setProjection() method, but this * more eloquently done via a setProjection() method, but this
* works for now and always. * works for now and always.
* *
* @param {Object} newParams * Parameters:
* * newParams - {Object}
* @type String
*/ */
getFullRequestString:function(newParams) { getFullRequestString:function(newParams) {
var projection = this.map.getProjection(); var projection = this.map.getProjection();
+51 -34
View File
@@ -4,38 +4,43 @@
/** /**
* @class * Class: OpenLayers.Layer.Markers
* * Inherits from:
* @requires OpenLayers/Layer.js * - <OpenLayers.Layer>
*/ */
OpenLayers.Layer.Markers = OpenLayers.Class.create(); OpenLayers.Layer.Markers = OpenLayers.Class.create();
OpenLayers.Layer.Markers.prototype = OpenLayers.Layer.Markers.prototype =
OpenLayers.Class.inherit( OpenLayers.Layer, { OpenLayers.Class.inherit( OpenLayers.Layer, {
/** Markers layer is never a base layer. /**
* * Property: isBaseLayer
* @type Boolean * {Boolean} Markers layer is never a base layer.
*/ */
isBaseLayer: false, isBaseLayer: false,
/** internal marker list /**
* @type Array(OpenLayers.Marker) */ * Property: markers
markers: null, * Array({<OpenLayers.Marker>}) internal marker list
*/
markers: null,
/** internal state of drawing. This is a workaround for the fact /**
* that the map does not call moveTo with a zoomChanged when the * Property: drawn
* map is first starting up. This lets us catch the case where we * {Boolean} internal state of drawing. This is a workaround for the fact
* have *never* drawn the layer, and draw it even if the zoom hasn't * that the map does not call moveTo with a zoomChanged when the map is
* changed. * first starting up. This lets us catch the case where we have *never*
* @type Boolean */ * drawn the layer, and draw it even if the zoom hasn't changed.
drawn: false, */
drawn: false,
/** /**
* @constructor * Constructor: OpenLayers.Layer.Markers
* Create a Markers layer.
* *
* @param {String} name * Parameters:
* @param {Object} options Hashtable of extra options to tag onto the layer * name - {String}
* options - {Object} Hashtable of extra options to tag onto the layer
*/ */
initialize: function(name, options) { initialize: function(name, options) {
OpenLayers.Layer.prototype.initialize.apply(this, arguments); OpenLayers.Layer.prototype.initialize.apply(this, arguments);
@@ -43,7 +48,7 @@ OpenLayers.Layer.Markers.prototype =
}, },
/** /**
* * Method: destroy
*/ */
destroy: function() { destroy: function() {
this.clearMarkers(); this.clearMarkers();
@@ -53,9 +58,12 @@ OpenLayers.Layer.Markers.prototype =
/** /**
* @param {OpenLayers.Bounds} bounds * Method: moveTo
* @param {Boolean} zoomChanged *
* @param {Boolean} dragging * Parameters:
* bounds - {<OpenLayers.Bounds>}
* zoomChanged - {Boolean}
* dragging - {Boolean}
*/ */
moveTo:function(bounds, zoomChanged, dragging) { moveTo:function(bounds, zoomChanged, dragging) {
OpenLayers.Layer.prototype.moveTo.apply(this, arguments); OpenLayers.Layer.prototype.moveTo.apply(this, arguments);
@@ -67,7 +75,10 @@ OpenLayers.Layer.Markers.prototype =
}, },
/** /**
* @param {OpenLayers.Marker} marker * Method: addMarker
*
* Parameters:
* marker - {<OpenLayers.Marker>}
*/ */
addMarker: function(marker) { addMarker: function(marker) {
this.markers.push(marker); this.markers.push(marker);
@@ -78,7 +89,10 @@ OpenLayers.Layer.Markers.prototype =
}, },
/** /**
* @param {OpenLayers.Marker} marker * Method: removeMarker
*
* Parameters:
* marker - {<OpenLayers.Marker>}
*/ */
removeMarker: function(marker) { removeMarker: function(marker) {
OpenLayers.Util.removeItem(this.markers, marker); OpenLayers.Util.removeItem(this.markers, marker);
@@ -89,7 +103,7 @@ OpenLayers.Layer.Markers.prototype =
}, },
/** /**
* * Method: clearMarkers
*/ */
clearMarkers: function() { clearMarkers: function() {
if (this.markers != null) { if (this.markers != null) {
@@ -99,7 +113,9 @@ OpenLayers.Layer.Markers.prototype =
} }
}, },
/** clear all the marker div's from the layer and then redraw all of them. /**
* Method: redraw
* clear all the marker div's from the layer and then redraw all of them.
* Use the map to recalculate new placement of markers. * Use the map to recalculate new placement of markers.
*/ */
redraw: function() { redraw: function() {
@@ -108,12 +124,13 @@ OpenLayers.Layer.Markers.prototype =
} }
}, },
/** Calculate the pixel location for the marker, create it, and /**
* Method: drawMarker
* *Private*. Calculate the pixel location for the marker, create it, and
* add it to the layer's div * add it to the layer's div
* *
* @private * Parameters:
* * marker - {<OpenLayers.Marker>}
* @param {OpenLayers.Marker} marker
*/ */
drawMarker: function(marker) { drawMarker: function(marker) {
var px = this.map.getLayerPxFromLonLat(marker.lonlat); var px = this.map.getLayerPxFromLonLat(marker.lonlat);
+101 -53
View File
@@ -3,35 +3,51 @@
* for the full text of the license. */ * for the full text of the license. */
/** /**
* @class
*
* @requires OpenLayers/Layer/EventPane.js * @requires OpenLayers/Layer/EventPane.js
* @requires OpenLayers/Layer/FixedZoomLevels.js * @requires OpenLayers/Layer/FixedZoomLevels.js
*
* Class: OpenLayers.Layer.MultiMap
*
* Inherits:
* - <OpenLayers.Layers.EventPane>
* - <OpenLayers.Layers.FixedZoomLevels>
*/ */
OpenLayers.Layer.MultiMap = OpenLayers.Class.create(); OpenLayers.Layer.MultiMap = OpenLayers.Class.create();
OpenLayers.Layer.MultiMap.prototype = OpenLayers.Layer.MultiMap.prototype =
OpenLayers.Class.inherit( OpenLayers.Layer.EventPane, OpenLayers.Class.inherit( OpenLayers.Layer.EventPane,
OpenLayers.Layer.FixedZoomLevels, { OpenLayers.Layer.FixedZoomLevels, {
/** @final @type int */ /**
* Constant: MIN_ZOOM_LEVEL
* {Integer} 1
*/
MIN_ZOOM_LEVEL: 1, MIN_ZOOM_LEVEL: 1,
/** @final @type int */ /**
* Constant: MAX_ZOOM_LEVEL
* {Integer} 17
*/
MAX_ZOOM_LEVEL: 17, MAX_ZOOM_LEVEL: 17,
/** Hardcode these resolutions so that they are more closely /**
* tied with the standard wms projection * Constant: RESOLUTIONS
* * {Array(Float)} Hardcode these resolutions so that they are more closely
* @final @type Array(float) */ * tied with the standard wms projection
*/
RESOLUTIONS: [9, 1.40625,0.703125,0.3515625,0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.001373291015625,0.0006866455078125,0.00034332275390625,0.000171661376953125,0.0000858306884765625,0.00004291534423828125], RESOLUTIONS: [9, 1.40625,0.703125,0.3515625,0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.001373291015625,0.0006866455078125,0.00034332275390625,0.000171661376953125,0.0000858306884765625,0.00004291534423828125],
/** @type VEMapType */ /**
* APIProperty: type
* {?}
*/
type: null, type: null,
/** /**
* @constructor * Constructor: OpenLayers.Layer.MultiMap
* *
* @param {String} name * Parameters:
* name - {String}
* options - {Object}
*/ */
initialize: function(name, options) { initialize: function(name, options) {
OpenLayers.Layer.EventPane.prototype.initialize.apply(this, arguments); OpenLayers.Layer.EventPane.prototype.initialize.apply(this, arguments);
@@ -40,7 +56,7 @@ OpenLayers.Layer.MultiMap.prototype =
}, },
/** /**
* * Method: loadMapObject
*/ */
loadMapObject:function() { loadMapObject:function() {
try { //crash proofing try { //crash proofing
@@ -49,9 +65,11 @@ OpenLayers.Layer.MultiMap.prototype =
}, },
/** /**
* @return String with information on why layer is broken, how to get * APIMethod: getWarningHTML
*
* Return:
* {String} String with information on why layer is broken, how to get
* it working. * it working.
* @type String
*/ */
getWarningHTML:function() { getWarningHTML:function() {
@@ -84,26 +102,33 @@ OpenLayers.Layer.MultiMap.prototype =
// Get&Set Center, Zoom // Get&Set Center, Zoom
/** Set the mapObject to the specified center and zoom /**
* APIMethod: setMapObjectCenter
* Set the mapObject to the specified center and zoom
* *
* @param {Object} center MapObject LonLat format * Parameters:
* @param {int} zoom MapObject zoom format * center - {Object} MapObject LonLat format
* zoom - {int} MapObject zoom format
*/ */
setMapObjectCenter: function(center, zoom) { setMapObjectCenter: function(center, zoom) {
this.mapObject.goToPosition(center, zoom); this.mapObject.goToPosition(center, zoom);
}, },
/** /**
* @returns the mapObject's current center in Map Object format * APIMethod: getMapObjectCenter
* @type Object *
* Return:
* {Object} The mapObject's current center in Map Object format
*/ */
getMapObjectCenter: function() { getMapObjectCenter: function() {
return this.mapObject.getCurrentPosition(); return this.mapObject.getCurrentPosition();
}, },
/** /**
* @returns the mapObject's current zoom, in Map Object format * APIMethod: getMapObjectZoom
* @type int *
* Return:
* {Integer} The mapObject's current zoom, in Map Object format
*/ */
getMapObjectZoom: function() { getMapObjectZoom: function() {
return this.mapObject.getZoomFactor(); return this.mapObject.getZoomFactor();
@@ -112,11 +137,14 @@ OpenLayers.Layer.MultiMap.prototype =
// LonLat - Pixel Translation // LonLat - Pixel Translation
/** /**
* @param {Object} moPixel MapObject Pixel format * APIMethod: getMapObjectLonLatFromMapObjectPixel
* *
* @returns MapObject LonLat translated from MapObject Pixel * Parameters:
* @type Object * moPixel - {Object} MapObject Pixel format
*
* Return:
* {Object} MapObject LonLat translated from MapObject Pixel
*/ */
getMapObjectLonLatFromMapObjectPixel: function(moPixel) { getMapObjectLonLatFromMapObjectPixel: function(moPixel) {
moPixel.x = moPixel.x - (this.map.getSize().w/2); moPixel.x = moPixel.x - (this.map.getSize().w/2);
@@ -124,11 +152,14 @@ OpenLayers.Layer.MultiMap.prototype =
return this.mapObject.getMapPositionAt(moPixel); return this.mapObject.getMapPositionAt(moPixel);
}, },
/** /**
* @param {Object} moPixel MapObject Pixel format * APIMethod: getMapObjectPixelFromMapObjectLonLat
* *
* @returns MapObject Pixel translated from MapObject LonLat * Parameters:
* @type Object * moLonLat - {Object} MapObject LonLat format
*
* Return:
* {Object} MapObject Pixel transtlated from MapObject LonLat
*/ */
getMapObjectPixelFromMapObjectLonLat: function(moLonLat) { getMapObjectPixelFromMapObjectLonLat: function(moLonLat) {
return this.mapObject.geoPosToContainerPixels(moLonLat); return this.mapObject.geoPosToContainerPixels(moLonLat);
@@ -145,31 +176,40 @@ OpenLayers.Layer.MultiMap.prototype =
// LonLat // LonLat
/** /**
* @param {Object} moLonLat MapObject LonLat format * APIMethod: getLongitudeFromMapObjectLonLat
* *
* @returns Longitude of the given MapObject LonLat * Parameters:
* @type float * moLonLat - {Object} MapObject LonLat format
*
* Return:
* {Float} Longitude of the given MapObject LonLat
*/ */
getLongitudeFromMapObjectLonLat: function(moLonLat) { getLongitudeFromMapObjectLonLat: function(moLonLat) {
return moLonLat.lon; return moLonLat.lon;
}, },
/** /**
* @param {Object} moLonLat MapObject LonLat format * APIMethod: getLatitudeFromMapObjectLonLat
* *
* @returns Latitude of the given MapObject LonLat * Parameters:
* @type float * moLonLat - {Object} MapObject LonLat format
*
* Return:
* {Float} Latitude of the given MapObject LonLat
*/ */
getLatitudeFromMapObjectLonLat: function(moLonLat) { getLatitudeFromMapObjectLonLat: function(moLonLat) {
return moLonLat.lat; return moLonLat.lat;
}, },
/** /**
* @param {int} lon float * APIMethod: getMapObjectLonLatFromLonLat
* @param {int} lat float
* *
* @returns MapObject LonLat built from lon and lat params * Parameters:
* @type Object * lon - {Float}
* lat - {Float}
*
* Return:
* {Object} MapObject LonLat built from lon and lat params
*/ */
getMapObjectLonLatFromLonLat: function(lon, lat) { getMapObjectLonLatFromLonLat: function(lon, lat) {
return new MMLatLon(lat, lon); return new MMLatLon(lat, lon);
@@ -177,38 +217,46 @@ OpenLayers.Layer.MultiMap.prototype =
// Pixel // Pixel
/** /**
* @param {Object} moPixel MapObject Pixel format * APIMethod: getXFromMapObjectPixel
* *
* @returns X value of the MapObject Pixel * Parameters:
* @type int * moPixel - {Object} MapObject Pixel format
*
* Return:
* {Integer} X value of the MapObject Pixel
*/ */
getXFromMapObjectPixel: function(moPixel) { getXFromMapObjectPixel: function(moPixel) {
return moPixel.x; return moPixel.x;
}, },
/** /**
* @param {Object} moPixel MapObject Pixel format * APIMethod: getYFromMapObjectPixel
* *
* @returns Y value of the MapObject Pixel * Parameters:
* @type int * moPixel - {Object} MapObject Pixel format
*
* Return:
* {Integer} Y value of the MapObject Pixel
*/ */
getYFromMapObjectPixel: function(moPixel) { getYFromMapObjectPixel: function(moPixel) {
return moPixel.y; return moPixel.y;
}, },
/** /**
* @param {int} x * APIMethod: getMapObjectPixelFromXY
* @param {int} y
* *
* @returns MapObject Pixel from x and y parameters * Parameters:
* @type Object * x - {Integer}
* y - {Integer}
*
* Return:
* {Object} MapObject Pixel from x and y parameters
*/ */
getMapObjectPixelFromXY: function(x, y) { getMapObjectPixelFromXY: function(x, y) {
return new MMPoint(x, y); return new MMPoint(x, y);
}, },
/** @final @type String */ /** @final @type String */
CLASS_NAME: "OpenLayers.Layer.MultiMap" CLASS_NAME: "OpenLayers.Layer.MultiMap"
}); });
+57 -31
View File
@@ -4,27 +4,44 @@
/** /**
* @class
*
* @requires OpenLayers/Layer/Grid.js * @requires OpenLayers/Layer/Grid.js
*
* Class: OpenLayers.Layer.TMS
*
* Inherits:
* - <OpenLayers.Layer.Grid>
*/ */
OpenLayers.Layer.TMS = OpenLayers.Class.create(); OpenLayers.Layer.TMS = OpenLayers.Class.create();
OpenLayers.Layer.TMS.prototype = OpenLayers.Layer.TMS.prototype =
OpenLayers.Class.inherit( OpenLayers.Layer.Grid, { OpenLayers.Class.inherit( OpenLayers.Layer.Grid, {
/**
* APIProperty: reproject
* {Boolean}
*/
reproject: false, reproject: false,
/**
* APIProperty: isBaseLayer
* {Boolean}
*/
isBaseLayer: true, isBaseLayer: true,
/**
* APIProperty: tileOrigin
* {<OpenLayers.Pixel>}
*/
tileOrigin: null, tileOrigin: null,
/** /**
* @constructor * Constructor: OpenLayers.Layer.TMS
* *
* @param {String} name * Parameters:
* @param {String} url * name - {String}
* @param {Object} params * url - {String}
* @param {Object} options Hashtable of extra options to tag onto the layer * params - {Object}
*/ * options - {Object} Hashtable of extra options to tag onto the layer
*/
initialize: function(name, url, options) { initialize: function(name, url, options) {
var newArguments = new Array(); var newArguments = new Array();
newArguments.push(name, url, {}, options); newArguments.push(name, url, {}, options);
@@ -32,7 +49,7 @@ OpenLayers.Layer.TMS.prototype =
}, },
/** /**
* * APIMethod:destroy
*/ */
destroy: function() { destroy: function() {
// for now, nothing special to do here. // for now, nothing special to do here.
@@ -41,10 +58,13 @@ OpenLayers.Layer.TMS.prototype =
/** /**
* @param {Object} obj * APIMethod: clone
* *
* @returns An exact clone of this OpenLayers.Layer.TMS * Parameters:
* @type OpenLayers.Layer.TMS * obj - {Object}
*
* Return:
* {<OpenLayers.Layer.TMS>} An exact clone of this <OpenLayers.Layer.TMS>
*/ */
clone: function (obj) { clone: function (obj) {
@@ -63,12 +83,15 @@ OpenLayers.Layer.TMS.prototype =
}, },
/** /**
* @param {OpenLayers.Bounds} bounds * Method: getUrl
* *
* @returns A string with the layer's url and parameters and also the * Parameters:
* passed-in bounds and appropriate tile size specified as * bounds - {<OpenLayers.Bounds>}
* parameters *
* @type String * Return:
* {String} A string with the layer's url and parameters and also the
* passed-in bounds and appropriate tile size specified as
* parameters
*/ */
getURL: function (bounds) { getURL: function (bounds) {
bounds = this.adjustBounds(bounds); bounds = this.adjustBounds(bounds);
@@ -85,24 +108,28 @@ OpenLayers.Layer.TMS.prototype =
}, },
/** /**
* addTile creates a tile, initializes it, and * Method: addTile
* adds it to the layer div. * addTile creates a tile, initializes it, and adds it to the layer div.
* *
* @param {OpenLayers.Bounds} bounds * Parameters:
* * bounds - {<OpenLayers.Bounds>}
* @returns The added OpenLayers.Tile.Image *
* @type OpenLayers.Tile.Image * Return:
*/ * {<OpenLayers.Tile.Image>} The added OpenLayers.Tile.Image
*/
addTile:function(bounds,position) { addTile:function(bounds,position) {
var url = this.getURL(bounds); var url = this.getURL(bounds);
return new OpenLayers.Tile.Image(this, position, bounds, return new OpenLayers.Tile.Image(this, position, bounds,
url, this.tileSize); url, this.tileSize);
}, },
/** When the layer is added to a map, then we can fetch our origin /**
* (if we don't have one.) * APIMethod: setMap
* When the layer is added to a map, then we can fetch our origin
* (if we don't have one.)
* *
* @param {OpenLayers.Map} map * Parameters:
* map - {<OpenLayers.Map>}
*/ */
setMap: function(map) { setMap: function(map) {
OpenLayers.Layer.Grid.prototype.setMap.apply(this, arguments); OpenLayers.Layer.Grid.prototype.setMap.apply(this, arguments);
@@ -112,7 +139,6 @@ OpenLayers.Layer.TMS.prototype =
} }
}, },
/** @final @type String */ /** @final @type String */
CLASS_NAME: "OpenLayers.Layer.TMS" CLASS_NAME: "OpenLayers.Layer.TMS"
}); });
+36 -16
View File
@@ -4,31 +4,45 @@
/** /**
* @class
*
* @requires OpenLayers/Layer/Markers.js * @requires OpenLayers/Layer/Markers.js
*
* Class: OpenLayers.Layer.Text
* Tab seperated values file parsing code which creates a markers layer.
*
* Inherits from;
* - <OpenLayers.Layer.Markers>
*/ */
OpenLayers.Layer.Text = OpenLayers.Class.create(); OpenLayers.Layer.Text = OpenLayers.Class.create();
OpenLayers.Layer.Text.prototype = OpenLayers.Layer.Text.prototype =
OpenLayers.Class.inherit( OpenLayers.Layer.Markers, { OpenLayers.Class.inherit( OpenLayers.Layer.Markers, {
/** store url of text file - this should be specified in the /**
* "options" hashtable * APIProperty: location
* @type str */ * {String} store url of text file - this should be specified in the
* "options" hashtable. Can not be changed once passed in.
*/
location:null, location:null,
/** @type Array(OpenLayers.Feature) */ /**
* Property: features
* Array({<OpenLayers.Feature>})
*/
features: null, features: null,
/** @type OpenLayers.Feature */ /**
* Property: selectedFeature
* {<OpenLayers.Feature>}
*/
selectedFeature: null, selectedFeature: null,
/** /**
* @constructor * Constructor: OpenLayers.Layer.Text
* * Create a text layer.
* @param {String} name *
* @param {String} location * Parameters:
* @param {Object} options Hashtable of extra options to tag onto the layer * name - {String}
* options - {Object} Hashtable of extra options to tag onto
* the layer. Must include "location" property.
*/ */
initialize: function(name, options) { initialize: function(name, options) {
OpenLayers.Layer.Markers.prototype.initialize.apply(this, arguments); OpenLayers.Layer.Markers.prototype.initialize.apply(this, arguments);
@@ -39,7 +53,7 @@ OpenLayers.Layer.Text.prototype =
}, },
/** /**
* * APIMethod: destroy
*/ */
destroy: function() { destroy: function() {
this.clearFeatures(); this.clearFeatures();
@@ -49,7 +63,10 @@ OpenLayers.Layer.Text.prototype =
/** /**
* @param {XMLHttpRequest} ajaxRequest * Method: parseData
*
* Parameters:
* ajaxRequest - {XMLHttpRequest}
*/ */
parseData: function(ajaxRequest) { parseData: function(ajaxRequest) {
var text = ajaxRequest.responseText; var text = ajaxRequest.responseText;
@@ -137,7 +154,10 @@ OpenLayers.Layer.Text.prototype =
}, },
/** /**
* @param {Event} evt * Property: markerClick
*
* Parameters:
* evt - {Event}
*/ */
markerClick: function(evt) { markerClick: function(evt) {
sameMarkerClicked = (this == this.layer.selectedFeature); sameMarkerClicked = (this == this.layer.selectedFeature);
@@ -152,7 +172,7 @@ OpenLayers.Layer.Text.prototype =
}, },
/** /**
* * Method: clearFeatures
*/ */
clearFeatures: function() { clearFeatures: function() {
if (this.features != null) { if (this.features != null) {
+129 -61
View File
@@ -3,71 +3,107 @@
* for the full text of the license. */ * for the full text of the license. */
/** /**
* @class
*
* @requires OpenLayers/Layer.js * @requires OpenLayers/Layer.js
* @requires OpenLayers/Renderer.js * @requires OpenLayers/Renderer.js
* @requires OpenLayers/Feature/Vector.js * @requires OpenLayers/Feature/Vector.js
*
* Class: OpenLayers.Layer.Vector
* Instances of OpenLayers.Layer.Vector are used to render vector data from
* a variety of sources. Create a new image layer with the
* <OpenLayers.Layer.Vector> constructor.
*
* Inherits from:
* - <OpenLayers.Layer>
*/ */
OpenLayers.Layer.Vector = OpenLayers.Class.create(); OpenLayers.Layer.Vector = OpenLayers.Class.create();
OpenLayers.Layer.Vector.prototype = OpenLayers.Layer.Vector.prototype =
OpenLayers.Class.inherit(OpenLayers.Layer, { OpenLayers.Class.inherit(OpenLayers.Layer, {
/** @type Boolean */ /**
* APIProperty: isBaseLayer
* {Boolean} The layer is a base layer. Default is true. Set this property
* in the layer options
*/
isBaseLayer: false, isBaseLayer: false,
/** @type Boolean */ /**
* APIProperty: isFixed
* {Boolean} Whether the layer remains in one place while dragging the
* map.
*/
isFixed: false, isFixed: false,
/** @type Boolean */ /**
* APIProperty: isVector
* {Boolean} Whether the layer is a vector layer.
*/
isVector: true, isVector: true,
/** @type Array(OpenLayer.Feature.Vector) */ /**
* APIProperty: features
* Array({<OpenLayers.Feature.Vector>})
*/
features: null, features: null,
/** @type Array(OpenLayers.Feature.Vector) */ /**
* Property: selectedFeatures
* Array({<OpenLayers.Feature.Vector>})
*/
selectedFeatures: null, selectedFeatures: null,
/** @type {Boolean} */ /**
* APIProperty: reportError
* {Boolean} report error message via alert() when loading of renderers
* fails.
*/
reportError: true, reportError: true,
/** @type {Object} */ /**
* APIProperty: style
* {Object} Default style for the layer
*/
style: null, style: null,
/** /**
* List of supported Renderer classes. Add to this list to * Property: renderers
* Array({String}) List of supported Renderer classes. Add to this list to
* add support for additional renderers. This list is ordered: * add support for additional renderers. This list is ordered:
* the first renderer which returns true for the 'supported()' * the first renderer which returns true for the 'supported()'
* method will be used, if not defined in the 'renderer' option. * method will be used, if not defined in the 'renderer' option.
*
* @type {Array(String)}
*/ */
renderers: ['SVG', 'VML'], renderers: ['SVG', 'VML'],
/** @type OpenLayers.Renderer */ /**
* Property: renderer
* {<OpenLayers.Renderer>}
*/
renderer: null, renderer: null,
/** /**
* geometryType allows you to limit the types of geometries this * APIProperty: geometryType
* layer supports. This should be set to something like * {String} geometryType allows you to limit the types of geometries this
* layer supports. This should be set to something like
* "OpenLayers.Geometry.Point" to limit types. * "OpenLayers.Geometry.Point" to limit types.
*
* @type string
*/ */
geometryType: null, geometryType: null,
/** Whether the Vector Layer features have been drawn yet. /**
* * Property: drawn
* @type boolean * {Boolean} Whether the Vector Layer features have been drawn yet.
*/ */
drawn: false, drawn: false,
/** /**
* @constructor * Constructor: OpenLayers.Layer.Vector
* Create a new vector layer
* *
* @param {String} name * Parameters:
* @param {Object} options Hashtable of extra options to tag onto the layer. * name - {String} A name for the layer
* Options renderer {Object}: Typically SVGRenderer or VMLRenderer. * options - {Object} options Object with non-default properties to set on
* the layer.
*
* Return:
* {<OpenLayers.Layer.Vector>} A new vector layer
*/ */
initialize: function(name, options) { initialize: function(name, options) {
@@ -92,7 +128,8 @@ OpenLayers.Layer.Vector.prototype =
}, },
/** /**
* * APIMethod: destroy
* Destroy this layer
*/ */
destroy: function() { destroy: function() {
OpenLayers.Layer.prototype.destroy.apply(this, arguments); OpenLayers.Layer.prototype.destroy.apply(this, arguments);
@@ -108,11 +145,10 @@ OpenLayers.Layer.Vector.prototype =
this.drawn = null; this.drawn = null;
}, },
/** Iterates through the available renderer implementations and selects /**
* and assigns the first one whose "supported()" function returns true. * Method: assignRenderer
* * Iterates through the available renderer implementations and selects
* @private * and assigns the first one whose "supported()" function returns true.
*
*/ */
assignRenderer: function() { assignRenderer: function() {
for (var i = 0; i < this.renderers.length; i++) { for (var i = 0; i < this.renderers.length; i++) {
@@ -125,10 +161,8 @@ OpenLayers.Layer.Vector.prototype =
}, },
/** /**
* Method: displayError
* Let the user know their browser isn't supported. * Let the user know their browser isn't supported.
*
* @private
*
*/ */
displayError: function() { displayError: function() {
if (this.reportError) { if (this.reportError) {
@@ -139,12 +173,15 @@ OpenLayers.Layer.Vector.prototype =
} }
}, },
/** The layer has been added to the map. /**
* Method: setMap
* The layer has been added to the map.
* *
* If there is no renderer set, the layer can't be used. Remove it. * If there is no renderer set, the layer can't be used. Remove it.
* Otherwise, give the renderer a reference to the map and set its size. * Otherwise, give the renderer a reference to the map and set its size.
* *
* @param {OpenLayers.Map} map * Parameters:
* map - {<OpenLayers.Map>}
*/ */
setMap: function(map) { setMap: function(map) {
OpenLayers.Layer.prototype.setMap.apply(this, arguments); OpenLayers.Layer.prototype.setMap.apply(this, arguments);
@@ -157,7 +194,9 @@ OpenLayers.Layer.Vector.prototype =
} }
}, },
/** Notify the renderer of the change in size. /**
* Method: onMapResize
* Notify the renderer of the change in size.
* *
*/ */
onMapResize: function() { onMapResize: function() {
@@ -165,7 +204,9 @@ OpenLayers.Layer.Vector.prototype =
this.renderer.setSize(this.map.getSize()); this.renderer.setSize(this.map.getSize());
}, },
/** Reset the vector layer's div so that it once again is lined up with /**
* Method: moveTo
* Reset the vector layer's div so that it once again is lined up with
* the map. Notify the renderer of the change of extent, and in the * the map. Notify the renderer of the change of extent, and in the
* case of a change of zoom level (resolution), have the * case of a change of zoom level (resolution), have the
* renderer redraw features. * renderer redraw features.
@@ -173,9 +214,10 @@ OpenLayers.Layer.Vector.prototype =
* If the layer has not yet been drawn, cycle through the layer's * If the layer has not yet been drawn, cycle through the layer's
* features and draw each one. * features and draw each one.
* *
* @param {OpenLayers.Bounds} bounds * Parameters:
* @param {Boolean} zoomChanged * bounds - {<OpenLayers.Bounds>}
* @param {Boolean} dragging * zoomChanged - {Boolean}
* dragging - {Boolean}
*/ */
moveTo: function(bounds, zoomChanged, dragging) { moveTo: function(bounds, zoomChanged, dragging) {
OpenLayers.Layer.prototype.moveTo.apply(this, arguments); OpenLayers.Layer.prototype.moveTo.apply(this, arguments);
@@ -197,7 +239,11 @@ OpenLayers.Layer.Vector.prototype =
}, },
/** /**
* @param {Array(OpenLayers.Feature.Vector} features * APIMethod: addFeatures
* Add Features to the layer.
*
* Parameters:
* features - {Array(<OpenLayers.Feature.Vector>)}
*/ */
addFeatures: function(features) { addFeatures: function(features) {
if (!(features instanceof Array)) { if (!(features instanceof Array)) {
@@ -235,7 +281,10 @@ OpenLayers.Layer.Vector.prototype =
/** /**
* @param {Array(OpenLayers.Feature.Vector} features * APIMethod: removeFeatures
*
* Parameters:
* features - {Array(<OpenLayers.Feature.Vector>)}
*/ */
removeFeatures: function(features) { removeFeatures: function(features) {
if (!(features instanceof Array)) { if (!(features instanceof Array)) {
@@ -259,6 +308,7 @@ OpenLayers.Layer.Vector.prototype =
}, },
/** /**
* APIMethod: destroyFeatures
* Destroy all features on the layer and empty the selected features array. * Destroy all features on the layer and empty the selected features array.
*/ */
destroyFeatures: function () { destroyFeatures: function () {
@@ -269,13 +319,15 @@ OpenLayers.Layer.Vector.prototype =
}, },
/** /**
* Method: drawFeature
* Draw (or redraw) a feature on the layer. If the optional style argument * Draw (or redraw) a feature on the layer. If the optional style argument
* is included, this style will be used. If no style is included, the * is included, this style will be used. If no style is included, the
* feature's style will be used. If the feature doesn't have a style, * feature's style will be used. If the feature doesn't have a style,
* the layer's style will be used. * the layer's style will be used.
* *
* @param {OpenLayers.Feature.Vector} feature * Parameters:
* @param {Object} style * feature - {<OpenLayers.Feature.Vector>}
* style - {Object}
*/ */
drawFeature: function(feature, style) { drawFeature: function(feature, style) {
if(style == null) { if(style == null) {
@@ -289,21 +341,26 @@ OpenLayers.Layer.Vector.prototype =
}, },
/** /**
* Method: eraseFeatures
* Erase features from the layer. * Erase features from the layer.
* *
* @param {Array(OpenLayers.Feature.Vector)} features * Parameters:
* features - {Array(OpenLayers.Feature.Vector)}
*/ */
eraseFeatures: function(features) { eraseFeatures: function(features) {
this.renderer.eraseFeatures(features); this.renderer.eraseFeatures(features);
}, },
/** /**
* Method: getFeatureFromEvent
* Given an event, return a feature if the event occurred over one. * Given an event, return a feature if the event occurred over one.
* Otherwise, return null. * Otherwise, return null.
* *
* @param {Event} * Parameters:
* @type OpenLayers.Feature.Vector * evt - {Event}
* @return A feature if one was under the event *
* Returns:
* {<OpenLayers.Feature.Vector>} A feature if one was under the event.
*/ */
getFeatureFromEvent: function(evt) { getFeatureFromEvent: function(evt) {
var featureId = this.renderer.getFeatureIdFromEvent(evt); var featureId = this.renderer.getFeatureIdFromEvent(evt);
@@ -311,11 +368,15 @@ OpenLayers.Layer.Vector.prototype =
}, },
/** /**
* APIMethod: getFeatureById
* Given a feature id, return the feature if it exists in the features array * Given a feature id, return the feature if it exists in the features array
* *
* @param {String} featureId * Parameters:
* @type OpenLayers.Feature.Vector * featureId - {String}
* @return A feature corresponding to the given featureId *
* Returns:
* {<OpenLayers.Feature.Vector>} A feature corresponding to the given
* featureId
*/ */
getFeatureById: function(featureId) { getFeatureById: function(featureId) {
//TBD - would it be more efficient to use a hash for this.features? //TBD - would it be more efficient to use a hash for this.features?
@@ -346,26 +407,33 @@ OpenLayers.Layer.Vector.prototype =
/** /**
* method called when a feature is inserted. * APIMethod: onFeatureInsert
* method called after a feature is inserted.
* Does nothing by default. Override this if you * Does nothing by default. Override this if you
* need to do something on feature updates. * need to do something on feature updates.
* *
* @param {OpenLayers.Feature.Vector} feature * Paarameters:
* feature - {<OpenLayers.Feature.Vector>}
*/ */
onFeatureInsert: function(feature) { onFeatureInsert: function(feature) {
}, },
/** /**
* APIMethod: preFeatureInsert
* method called before a feature is inserted. * method called before a feature is inserted.
* Does nothing by default. Override this if you * Does nothing by default. Override this if you
* need to do something when features are first added to the * need to do something when features are first added to the
* layer, but before they are drawn, such as adjust the style. * layer, but before they are drawn, such as adjust the style.
* *
* @param {OpenLayers.Feature.Vector} feature * Parameters:
* feature - {<OpenLayers.Feature.Vector>}
*/ */
preFeatureInsert: function(feature) { preFeatureInsert: function(feature) {
}, },
/** @final @type String */ /**
* Constant: CLASS_NAME
* {String} 'OpenLayers.Layer.Vector'
*/
CLASS_NAME: "OpenLayers.Layer.Vector" CLASS_NAME: "OpenLayers.Layer.Vector"
}); });
+102 -54
View File
@@ -4,35 +4,51 @@
/** /**
* @class
*
* @requires OpenLayers/Layer/EventPane.js * @requires OpenLayers/Layer/EventPane.js
* @requires OpenLayers/Layer/FixedZoomLevels.js * @requires OpenLayers/Layer/FixedZoomLevels.js
*
* Class: OpenLayers.Layer.VirtualEarth
*
* Inherits:
* - <OpenLayers.Layer.EventPane>
* - <OpenLayers.Layer.FixedZoomLevels>
*/ */
OpenLayers.Layer.VirtualEarth = OpenLayers.Class.create(); OpenLayers.Layer.VirtualEarth = OpenLayers.Class.create();
OpenLayers.Layer.VirtualEarth.prototype = OpenLayers.Layer.VirtualEarth.prototype =
OpenLayers.Class.inherit( OpenLayers.Layer.EventPane, OpenLayers.Class.inherit( OpenLayers.Layer.EventPane,
OpenLayers.Layer.FixedZoomLevels, { OpenLayers.Layer.FixedZoomLevels, {
/** @final @type int */ /**
* Constant: MIN_ZOOM_LEVEL
* {Integer} 1
*/
MIN_ZOOM_LEVEL: 1, MIN_ZOOM_LEVEL: 1,
/** @final @type int */ /**
* Constant: MAX_ZOOM_LEVEL
* {Integer} 17
*/
MAX_ZOOM_LEVEL: 17, MAX_ZOOM_LEVEL: 17,
/** Hardcode these resolutions so that they are more closely /**
* tied with the standard wms projection * Constant: RESOLUTIONS
* * {Array(Float)} Hardcode these resolutions so that they are more closely
* @final @type Array(float) */ * tied with the standard wms projection
*/
RESOLUTIONS: [1.40625,0.703125,0.3515625,0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.001373291015625,0.0006866455078125,0.00034332275390625,0.000171661376953125,0.0000858306884765625,0.00004291534423828125], RESOLUTIONS: [1.40625,0.703125,0.3515625,0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.001373291015625,0.0006866455078125,0.00034332275390625,0.000171661376953125,0.0000858306884765625,0.00004291534423828125],
/** @type VEMapType */ /**
* APIProperty: type
* {VEMapType}
*/
type: null, type: null,
/** /**
* @constructor * Constructor: OpenLayers.Layer.VirtualEarth
* *
* @param {String} name * Parameters:
* name - {String}
* options - {Object}
*/ */
initialize: function(name, options) { initialize: function(name, options) {
OpenLayers.Layer.EventPane.prototype.initialize.apply(this, arguments); OpenLayers.Layer.EventPane.prototype.initialize.apply(this, arguments);
@@ -41,7 +57,7 @@ OpenLayers.Layer.VirtualEarth.prototype =
}, },
/** /**
* * Method: loadMapObject
*/ */
loadMapObject:function() { loadMapObject:function() {
@@ -65,9 +81,11 @@ OpenLayers.Layer.VirtualEarth.prototype =
}, },
/** /**
* @return String with information on why layer is broken, how to get * APIMethod: getWarningHTML
*
* Return:
* {String} String with information on why layer is broken, how to get
* it working. * it working.
* @type String
*/ */
getWarningHTML:function() { getWarningHTML:function() {
@@ -100,26 +118,33 @@ OpenLayers.Layer.VirtualEarth.prototype =
// Get&Set Center, Zoom // Get&Set Center, Zoom
/** Set the mapObject to the specified center and zoom /**
* APIMethod: setMapObjectCenter
* Set the mapObject to the specified center and zoom
* *
* @param {Object} center MapObject LonLat format * Parameters:
* @param {int} zoom MapObject zoom format * center - {Object} MapObject LonLat format
* zoom - {int} MapObject zoom format
*/ */
setMapObjectCenter: function(center, zoom) { setMapObjectCenter: function(center, zoom) {
this.mapObject.SetCenterAndZoom(center, zoom); this.mapObject.SetCenterAndZoom(center, zoom);
}, },
/** /**
* @returns the mapObject's current center in Map Object format * APIMethod: getMapObjectCenter
* @type Object *
* Return:
* {Object} The mapObject's current center in Map Object format
*/ */
getMapObjectCenter: function() { getMapObjectCenter: function() {
return this.mapObject.GetCenter(); return this.mapObject.GetCenter();
}, },
/** /**
* @returns the mapObject's current zoom, in Map Object format * APIMethod: getMapObjectZoom
* @type int *
* Return:
* {Integer} The mapObject's current zoom, in Map Object format
*/ */
getMapObjectZoom: function() { getMapObjectZoom: function() {
return this.mapObject.GetZoomLevel(); return this.mapObject.GetZoomLevel();
@@ -128,21 +153,27 @@ OpenLayers.Layer.VirtualEarth.prototype =
// LonLat - Pixel Translation // LonLat - Pixel Translation
/** /**
* @param {Object} moPixel MapObject Pixel format * APIMethod: getMapObjectLonLatFromMapObjectPixel
* *
* @returns MapObject LonLat translated from MapObject Pixel * Parameters:
* @type Object * moPixel - {Object} MapObject Pixel format
*
* Return:
* {Object} MapObject LonLat translated from MapObject Pixel
*/ */
getMapObjectLonLatFromMapObjectPixel: function(moPixel) { getMapObjectLonLatFromMapObjectPixel: function(moPixel) {
return this.mapObject.PixelToLatLong(moPixel.x, moPixel.y); return this.mapObject.PixelToLatLong(moPixel.x, moPixel.y);
}, },
/** /**
* @param {Object} moPixel MapObject Pixel format * APIMethod: getMapObjectPixelFromMapObjectLonLat
* *
* @returns MapObject Pixel translated from MapObject LonLat * Parameters:
* @type Object * moLonLat - {Object} MapObject LonLat format
*
* Return:
* {Object} MapObject Pixel transtlated from MapObject LonLat
*/ */
getMapObjectPixelFromMapObjectLonLat: function(moLonLat) { getMapObjectPixelFromMapObjectLonLat: function(moLonLat) {
return this.mapObject.LatLongToPixel(moLonLat); return this.mapObject.LatLongToPixel(moLonLat);
@@ -159,31 +190,40 @@ OpenLayers.Layer.VirtualEarth.prototype =
// LonLat // LonLat
/** /**
* @param {Object} moLonLat MapObject LonLat format * APIMethod: getLongitudeFromMapObjectLonLat
* *
* @returns Longitude of the given MapObject LonLat * Parameters:
* @type float * moLonLat - {Object} MapObject LonLat format
*
* Return:
* {Float} Longitude of the given MapObject LonLat
*/ */
getLongitudeFromMapObjectLonLat: function(moLonLat) { getLongitudeFromMapObjectLonLat: function(moLonLat) {
return moLonLat.Longitude; return moLonLat.Longitude;
}, },
/** /**
* @param {Object} moLonLat MapObject LonLat format * APIMethod: getLatitudeFromMapObjectLonLat
* *
* @returns Latitude of the given MapObject LonLat * Parameters:
* @type float * moLonLat - {Object} MapObject LonLat format
*
* Return:
* {Float} Latitude of the given MapObject LonLat
*/ */
getLatitudeFromMapObjectLonLat: function(moLonLat) { getLatitudeFromMapObjectLonLat: function(moLonLat) {
return moLonLat.Latitude; return moLonLat.Latitude;
}, },
/** /**
* @param {int} lon float * APIMethod: getMapObjectLonLatFromLonLat
* @param {int} lat float
* *
* @returns MapObject LonLat built from lon and lat params * Parameters:
* @type Object * lon - {Float}
* lat - {Float}
*
* Return:
* {Object} MapObject LonLat built from lon and lat params
*/ */
getMapObjectLonLatFromLonLat: function(lon, lat) { getMapObjectLonLatFromLonLat: function(lon, lat) {
return new VELatLong(lat, lon); return new VELatLong(lat, lon);
@@ -191,38 +231,46 @@ OpenLayers.Layer.VirtualEarth.prototype =
// Pixel // Pixel
/** /**
* @param {Object} moPixel MapObject Pixel format * APIMethod: getXFromMapObjectPixel
* *
* @returns X value of the MapObject Pixel * Parameters:
* @type int * moPixel - {Object} MapObject Pixel format
*
* Return:
* {Integer} X value of the MapObject Pixel
*/ */
getXFromMapObjectPixel: function(moPixel) { getXFromMapObjectPixel: function(moPixel) {
return moPixel.x; return moPixel.x;
}, },
/** /**
* @param {Object} moPixel MapObject Pixel format * APIMethod: getYFromMapObjectPixel
* *
* @returns Y value of the MapObject Pixel * Parameters:
* @type int * moPixel - {Object} MapObject Pixel format
*
* Return:
* {Integer} Y value of the MapObject Pixel
*/ */
getYFromMapObjectPixel: function(moPixel) { getYFromMapObjectPixel: function(moPixel) {
return moPixel.y; return moPixel.y;
}, },
/** /**
* @param {int} x * APIMethod: getMapObjectPixelFromXY
* @param {int} y
* *
* @returns MapObject Pixel from x and y parameters * Parameters:
* @type Object * x - {Integer}
* y - {Integer}
*
* Return:
* {Object} MapObject Pixel from x and y parameters
*/ */
getMapObjectPixelFromXY: function(x, y) { pObjectPixelFromXY: function(x, y) {
return new Msn.VE.Pixel(x, y); return new Msn.VE.Pixel(x, y);
}, },
/** @final @type String */ /** @final @type String */
CLASS_NAME: "OpenLayers.Layer.VirtualEarth" CLASS_NAME: "OpenLayers.Layer.VirtualEarth"
}); });
+76 -46
View File
@@ -4,55 +4,63 @@
/** /**
* @class
*
* @requires OpenLayers/Layer/Vector.js * @requires OpenLayers/Layer/Vector.js
* @requires OpenLayers/Layer/Markers.js * @requires OpenLayers/Layer/Markers.js
*
* Class: OpenLayers.Layer.WFS
*
* Inherits from:
* - <OpenLayers.Layer.Vector>
* - <OpenLayers.Layer.Markers>
*/ */
OpenLayers.Layer.WFS = OpenLayers.Class.create(); OpenLayers.Layer.WFS = OpenLayers.Class.create();
OpenLayers.Layer.WFS.prototype = OpenLayers.Layer.WFS.prototype =
OpenLayers.Class.inherit( OpenLayers.Layer.Vector, OpenLayers.Layer.Markers, { OpenLayers.Class.inherit( OpenLayers.Layer.Vector, OpenLayers.Layer.Markers, {
/** WFS layer is never a base layer. /**
* * APIProperty: isBaseLayer
* @type Boolean * {Boolean} WFS layer is not a base layer by default.
*/ */
isBaseLayer: false, isBaseLayer: false,
/** the ratio of image/tile size to map size (this is the untiled buffer) /**
* @type int */ * APIProperty: ratio
* {Float} the ratio of image/tile size to map size (this is the untiled
* buffer)
*/
ratio: 2, ratio: 2,
/** Hashtable of default key/value parameters /**
* @final @type Object */ * Property: DEFAULT_PARAMS
* {Object} Hashtable of default key/value parameters
*/
DEFAULT_PARAMS: { service: "WFS", DEFAULT_PARAMS: { service: "WFS",
version: "1.0.0", version: "1.0.0",
request: "GetFeature" request: "GetFeature"
}, },
/** /**
* If featureClass is defined, an old-style markers based * APIProperty: featureClass
* WFS layer is created instead of a new-style vector layer. * {<OpenLayers.Feature>} If featureClass is defined, an old-style markers
* If sent, this should be a subclass of OpenLayers.Feature * based WFS layer is created instead of a new-style vector layer. If
* * sent, this should be a subclass of OpenLayers.Feature
* @type OpenLayers.Feature
*/ */
featureClass: null, featureClass: null,
/** /**
* Should be calculated automatically. * Property: vectorMode
* * {Boolean} Should be calculated automatically.
* @type Boolean
*/ */
vectorMode: true, vectorMode: true,
/** /**
* @constructor * Constructor: OpenLayers.Layer.WFS
* *
* @param {String} name * Parameters:
* @param {String} url * name - {String}
* @param {Object} params * url - {String}
* @param {Object} options Hashtable of extra options to tag onto the layer * params - {Object}
* options - {Object} Hashtable of extra options to tag onto the layer
*/ */
initialize: function(name, url, params, options) { initialize: function(name, url, params, options) {
if (options == undefined) { options = {}; } if (options == undefined) { options = {}; }
@@ -93,7 +101,7 @@ OpenLayers.Layer.WFS.prototype =
/** /**
* * APIMethod: destroy
*/ */
destroy: function() { destroy: function() {
if (this.vectorMode) { if (this.vectorMode) {
@@ -104,7 +112,10 @@ OpenLayers.Layer.WFS.prototype =
}, },
/** /**
* @param {OpenLayers.Map} map * Method: setMap
*
* Parameters:
* map - {<OpenLayers.Map>}
*/ */
setMap: function(map) { setMap: function(map) {
if (this.vectorMode) { if (this.vectorMode) {
@@ -115,9 +126,12 @@ OpenLayers.Layer.WFS.prototype =
}, },
/** /**
* @param {OpenLayers.Bounds} bounds * Method: moveTo
* @param {Boolean} zoomChanged *
* @param {Boolean} dragging * Parameters:
* bounds - {<OpenLayers.Bounds>}
* zoomChanged - {Boolean}
* dragging - {Boolean}
*/ */
moveTo:function(bounds, zoomChanged, dragging) { moveTo:function(bounds, zoomChanged, dragging) {
if (this.vectorMode) { if (this.vectorMode) {
@@ -204,6 +218,7 @@ OpenLayers.Layer.WFS.prototype =
}, },
/** /**
* Method: onMapResize
* Call the onMapResize method of the appropriate parent class. * Call the onMapResize method of the appropriate parent class.
*/ */
onMapResize: function() { onMapResize: function() {
@@ -215,10 +230,13 @@ OpenLayers.Layer.WFS.prototype =
}, },
/** /**
* @param {Object} obj * APIMethod: clone
*
* Parameters:
* obj - {Object}
* *
* @returns An exact clone of this OpenLayers.Layer.WMS * Returns:
* @type OpenLayers.Layer.WMS * {<OpenLayers.Layer.WFS>} LAn exact clone of this OpenLayers.Layer.WFS
*/ */
clone: function (obj) { clone: function (obj) {
@@ -241,16 +259,17 @@ OpenLayers.Layer.WFS.prototype =
return obj; return obj;
}, },
/** combine the layer's url with its params and these newParams. /**
* * APIMethod: getFullRequestString
* Add the SRS parameter from 'projection' -- this is probably * combine the layer's url with its params and these newParams.
* more eloquently done via a setProjection() method, but this *
* works for now and always. * Add the SRS parameter from 'projection' -- this is probably
* * more eloquently done via a setProjection() method, but this
* @param {Object} newParams * works for now and always.
* *
* @type String * Parameters:
*/ * newParams - {Object}
*/
getFullRequestString:function(newParams) { getFullRequestString:function(newParams) {
var projection = this.map.getProjection(); var projection = this.map.getProjection();
this.params.SRS = (projection == "none") ? null : projection; this.params.SRS = (projection == "none") ? null : projection;
@@ -258,7 +277,11 @@ OpenLayers.Layer.WFS.prototype =
return OpenLayers.Layer.Grid.prototype.getFullRequestString.apply( return OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(
this, arguments); this, arguments);
}, },
/**
* APIMethod: commit
* Write out the data to a WFS server.
*/
commit: function() { commit: function() {
if (!this.writer) { if (!this.writer) {
this.writer = new OpenLayers.Format.WFS({},this); this.writer = new OpenLayers.Format.WFS({},this);
@@ -288,9 +311,11 @@ OpenLayers.Layer.WFS.prototype =
}, },
/** /**
* Method: commitSuccess
* Called when the Ajax request returns a response * Called when the Ajax request returns a response
* *
* @param {XmlNode} response from server * Parameters:
* response - {XmlNode} from server
*/ */
commitSuccess: function(request) { commitSuccess: function(request) {
var response = request.responseText; var response = request.responseText;
@@ -309,18 +334,22 @@ OpenLayers.Layer.WFS.prototype =
}, },
/** /**
* Method: commitFailure
* Called when the Ajax request fails * Called when the Ajax request fails
* *
* @param {XmlNode} response from server * Parameters:
* response - {XmlNode} from server
*/ */
commitFailure: function(request) {}, commitFailure: function(request) {},
/** /**
* APIMethod: commitReport
* Called with a 'success' message if the commit succeeded, otherwise * Called with a 'success' message if the commit succeeded, otherwise
* a failure message, and the full text as a second parameter. * a failure message, and the full request text as a second parameter.
* Override this function to provide custom transaction reporting.
* *
* @param {String} string reporting string * string - {String} reporting string
* @param {String} response full XML response * response - {String} full XML response
*/ */
commitReport: function(string, response) { commitReport: function(string, response) {
alert(string); alert(string);
@@ -328,6 +357,7 @@ OpenLayers.Layer.WFS.prototype =
/** /**
* APIMethod: refresh
* Refreshes all the features of the layer * Refreshes all the features of the layer
*/ */
refresh: function() { refresh: function() {
+83 -43
View File
@@ -4,17 +4,25 @@
/** /**
* @class
*
* @requires OpenLayers/Layer/Grid.js * @requires OpenLayers/Layer/Grid.js
* @requires OpenLayers/Tile/Image.js * @requires OpenLayers/Tile/Image.js
*
* Class: OpenLayers.Layer.WMS
* Instances of OpenLayers.Layer.WMS are used to display data from OGC Web
* Mapping Services. Create a new WMS layer with the <OpenLayers.Layer.WMS>
* constructor.
*
* Inherits from:
* - <OpenLayers.Layer.Grid>
*/ */
OpenLayers.Layer.WMS = OpenLayers.Class.create(); OpenLayers.Layer.WMS = OpenLayers.Class.create();
OpenLayers.Layer.WMS.prototype = OpenLayers.Layer.WMS.prototype =
OpenLayers.Class.inherit( OpenLayers.Layer.Grid, { OpenLayers.Class.inherit( OpenLayers.Layer.Grid, {
/** Hashtable of default parameter key/value pairs /**
* @final @type Object */ * Constant: DEFAULT_PARAMS
* {Object} Hashtable of default parameter key/value pairs
*/
DEFAULT_PARAMS: { service: "WMS", DEFAULT_PARAMS: { service: "WMS",
version: "1.1.1", version: "1.1.1",
request: "GetMap", request: "GetMap",
@@ -23,16 +31,34 @@ OpenLayers.Layer.WMS.prototype =
format: "image/jpeg" format: "image/jpeg"
}, },
/**
* Property: reproject
* {Boolean} Try to reproject this layer if its coordinate reference system
* is different than that of the base layer. Default is true.
* Set this in the layer options. Should be set to false in
* most cases.
*/
reproject: true, reproject: true,
/** /**
* @constructor * Constructor: OpenLayers.Layer.WMS
* * Create a new WMS layer object
* @param {String} name *
* @param {String} url * Example:
* @param {Object} params * (code)
* @param {Object} options Hashtable of extra options to tag onto the layer * var wms = new OpenLayers.Layer.WMS("NASA Global Mosaic",
*/ * "http://wms.jpl.nasa.gov/wms.cgi",
* {layers: "modis,global_mosaic"});
* (end)
*
* Parameters:
* name - {String} A name for the layer
* url - {String} Base url for the WMS
* (e.g. http://wms.jpl.nasa.gov/wms.cgi)
* params - {Object} An object with key/value pairs representing the
* GetMap query string parameters and parameter values.
* options - {Ojbect} Hashtable of extra options to tag onto the layer
*/
initialize: function(name, url, params, options) { initialize: function(name, url, params, options) {
var newArguments = new Array(); var newArguments = new Array();
//uppercase params //uppercase params
@@ -54,7 +80,8 @@ OpenLayers.Layer.WMS.prototype =
}, },
/** /**
* * Method: destroy
* Destroy this layer
*/ */
destroy: function() { destroy: function() {
// for now, nothing special to do here. // for now, nothing special to do here.
@@ -63,10 +90,11 @@ OpenLayers.Layer.WMS.prototype =
/** /**
* @param {Object} obj * Method: clone
* * Create a clone of this layer
* @returns An exact clone of this OpenLayers.Layer.WMS *
* @type OpenLayers.Layer.WMS * Return:
* {<OpenLayers.Layer.WMS>} An exact clone of this layer
*/ */
clone: function (obj) { clone: function (obj) {
@@ -86,12 +114,17 @@ OpenLayers.Layer.WMS.prototype =
}, },
/** /**
* @param {OpenLayers.Bounds} bounds * Method: getURL
* * Return a GetMap query string for this layer
* @returns A string with the layer's url and parameters and also the *
* passed-in bounds and appropriate tile size specified as * Parameters:
* parameters * bounds - {<OpenLayers.Bounds>} A bounds representing the bbox for the
* @type String * request.
*
* Return:
* {String} A string with the layer's url and parameters and also the
* passed-in bounds and appropriate tile size specified as
* parameters.
*/ */
getURL: function (bounds) { getURL: function (bounds) {
bounds = this.adjustBounds(bounds); bounds = this.adjustBounds(bounds);
@@ -102,14 +135,15 @@ OpenLayers.Layer.WMS.prototype =
}, },
/** /**
* addTile creates a tile, initializes it, and * Method: addTile
* adds it to the layer div. * addTile creates a tile, initializes it, and adds it to the layer div.
* *
* @param {OpenLayers.Bounds} bounds * Parameters:
* * bounds - {<OpenLayers.Bounds>}
* @returns The added OpenLayers.Tile.Image *
* @type OpenLayers.Tile.Image * Return:
*/ * {<OpenLayers.Tile.Image>} The added OpenLayers.Tile.Image
*/
addTile:function(bounds,position) { addTile:function(bounds,position) {
var url = this.getURL(bounds); var url = this.getURL(bounds);
return new OpenLayers.Tile.Image(this, position, bounds, return new OpenLayers.Tile.Image(this, position, bounds,
@@ -117,12 +151,14 @@ OpenLayers.Layer.WMS.prototype =
}, },
/** /**
* APIMethod: mergeNewParams
* Catch changeParams and uppercase the new params to be merged in * Catch changeParams and uppercase the new params to be merged in
* before calling changeParams on the super class. * before calling changeParams on the super class.
* *
* Once params have been changed, we will need to re-init our tiles * Once params have been changed, we will need to re-init our tiles.
* *
* @param {Object} newParams Hashtable of new params to use * Parameters:
* newParams - {Object} Hashtable of new params to use
*/ */
mergeNewParams:function(newParams) { mergeNewParams:function(newParams) {
var upperParams = OpenLayers.Util.upperCaseObject(newParams); var upperParams = OpenLayers.Util.upperCaseObject(newParams);
@@ -131,16 +167,20 @@ OpenLayers.Layer.WMS.prototype =
newArguments); newArguments);
}, },
/** combine the layer's url with its params and these newParams. /**
* * Method: getFullRequestString
* Add the SRS parameter from projection -- this is probably * Combine the layer's url with its params and these newParams.
* more eloquently done via a setProjection() method, but this *
* works for now and always. * Add the SRS parameter from projection -- this is probably
* * more eloquently done via a setProjection() method, but this
* @param {Object} newParams * works for now and always.
* *
* @type String * Parameters:
*/ * newParams - {Object}
*
* Return:
* {String}
*/
getFullRequestString:function(newParams) { getFullRequestString:function(newParams) {
var projection = this.map.getProjection(); var projection = this.map.getProjection();
this.params.SRS = (projection == "none") ? null : projection; this.params.SRS = (projection == "none") ? null : projection;
+77 -31
View File
@@ -4,17 +4,22 @@
/** /**
* @class
*
* @requires OpenLayers/Layer/HTTPRequest.js * @requires OpenLayers/Layer/HTTPRequest.js
* @requires OpenLayers/Layer/WMS.js * @requires OpenLayers/Layer/WMS.js
*
* Class: OpenLayers.Layer.WMS
*
* Inherits from:
* - <OpenLayers.Layer.HTTPRequest>
*/ */
OpenLayers.Layer.WMS.Untiled = OpenLayers.Class.create(); OpenLayers.Layer.WMS.Untiled = OpenLayers.Class.create();
OpenLayers.Layer.WMS.Untiled.prototype = OpenLayers.Layer.WMS.Untiled.prototype =
OpenLayers.Class.inherit( OpenLayers.Layer.HTTPRequest, { OpenLayers.Class.inherit( OpenLayers.Layer.HTTPRequest, {
/** Hashtable of default parameter key/value pairs /**
* @final @type Object */ * Property: DEFAULT_PARAMS
* Hashtable of default parameter key/value pairs
*/
DEFAULT_PARAMS: { service: "WMS", DEFAULT_PARAMS: { service: "WMS",
version: "1.1.1", version: "1.1.1",
request: "GetMap", request: "GetMap",
@@ -22,25 +27,40 @@ OpenLayers.Layer.WMS.Untiled.prototype =
exceptions: "application/vnd.ogc.se_inimage", exceptions: "application/vnd.ogc.se_inimage",
format: "image/jpeg" format: "image/jpeg"
}, },
/**
* APIProperty: reproject
* Whether or not to use the base layer as a basis for 'staking' the corners
* of the image geographically.
*/
reproject: true, reproject: true,
/** the ratio of image/tile size to map size (this is the untiled buffer) /**
* @type int */ * APIProperty: ratio
* {Float} the ratio of image/tile size to map size (this is the untiled
* buffer)
*/
ratio: 2, ratio: 2,
/** @type OpenLayers.Tile.Image */ /**
* Property: tile
* {<OpenLayers.Tile.Image>}
*/
tile: null, tile: null,
/** did the image finish loading before a new draw was initiated? /**
* @type Boolean */ * Property: doneLoading
* {Boolean} did the image finish loading before a new draw was initiated?
*/
doneLoading: false, doneLoading: false,
/** /**
* @constructor * Constructor: OpenLayers.Layer.WMS.Untiled
* *
* @param {String} name * Parameters:
* @param {String} url * name - {String}
* @param {Object} params * url - {String}
* params - {Object}
* options - {Object}
*/ */
initialize: function(name, url, params, options) { initialize: function(name, url, params, options) {
var newArguments = new Array(); var newArguments = new Array();
@@ -64,7 +84,7 @@ OpenLayers.Layer.WMS.Untiled.prototype =
}, },
/** /**
* * APIMethod: destroy
*/ */
destroy: function() { destroy: function() {
if (this.tile) { if (this.tile) {
@@ -75,10 +95,14 @@ OpenLayers.Layer.WMS.Untiled.prototype =
}, },
/** /**
* @param {Object} obj * APIMethod: clone
* Makes an exact clone of this OpenLayers.Layer.WMS.Untiled
* *
* @returns An exact clone of this OpenLayers.Layer.WMS.Untiled * Parameters:
* @type OpenLayers.Layer.WMS.Untiled * obj - {Object}
*
* Returns:
* {<OpenLayers.Layer.WMS.Untiled>}
*/ */
clone: function (obj) { clone: function (obj) {
@@ -100,15 +124,19 @@ OpenLayers.Layer.WMS.Untiled.prototype =
}, },
/** Once HTTPRequest has set the map, we can load the image div /**
* Method: setMap
* Once HTTPRequest has set the map, we can load the image div
* *
* @param {OpenLayers.Map} map * Parameters:
* map - {<OpenLayers.Map>}
*/ */
setMap: function(map) { setMap: function(map) {
OpenLayers.Layer.HTTPRequest.prototype.setMap.apply(this, arguments); OpenLayers.Layer.HTTPRequest.prototype.setMap.apply(this, arguments);
}, },
/** /**
* Method: setTileSize
* Set the tile size based on the map size. This also sets layer.imageSize * Set the tile size based on the map size. This also sets layer.imageSize
* and layer.imageOffset for use by Tile.Image. * and layer.imageOffset for use by Tile.Image.
*/ */
@@ -121,12 +149,15 @@ OpenLayers.Layer.WMS.Untiled.prototype =
this.imageOffset = new OpenLayers.Pixel(0, 0); this.imageOffset = new OpenLayers.Pixel(0, 0);
}, },
/** When it is not a dragging move (ie when done dragging) /**
* Method: moveTo
* When it is not a dragging move (ie when done dragging)
* reload and recenter the div. * reload and recenter the div.
* *
* @param {OpenLayers.Bounds} bounds * Parameters:
* @param {Boolean} zoomChanged * bounds - {<OpenLayers.Bounds>}
* @param {Boolean} dragging * zoomChanged - {Boolean}
* dragging - {Boolean}
*/ */
moveTo:function(bounds, zoomChanged, dragging) { moveTo:function(bounds, zoomChanged, dragging) {
if (!this.doneLoading) { if (!this.doneLoading) {
@@ -197,6 +228,12 @@ OpenLayers.Layer.WMS.Untiled.prototype =
} }
}, },
/**
* Method: getURL
*
* Parameters:
* bounds - {<OpenLayers.Bounds>}
*/
getURL: function(bounds) { getURL: function(bounds) {
return this.getFullRequestString( {'BBOX': bounds.toBBOX(), return this.getFullRequestString( {'BBOX': bounds.toBBOX(),
'WIDTH': this.tileSize.w, 'WIDTH': this.tileSize.w,
@@ -204,16 +241,24 @@ OpenLayers.Layer.WMS.Untiled.prototype =
}, },
/** Once HTTPRequest has updated the url, reload the image div /**
* @param {String} newUrl * Method: setURL
* Once HTTPRequest has updated the url, reload the image div
*
* Parameters:
* newUrl - {String}
*/ */
setUrl: function(newUrl) { setUrl: function(newUrl) {
OpenLayers.Layer.HTTPRequest.prototype.setUrl.apply(this, arguments); OpenLayers.Layer.HTTPRequest.prototype.setUrl.apply(this, arguments);
this.moveTo(); this.moveTo();
}, },
/** Once HTTPRequest has updated new params, reload the image div /**
* @param {Object} newParams * APIMethod: mergeNewParams
* Once HTTPRequest has updated new params, reload the image div
*
* Parameters:
* newParams - {Object}
*/ */
mergeNewParams:function(newParams) { mergeNewParams:function(newParams) {
var upperParams = OpenLayers.Util.upperCaseObject(newParams); var upperParams = OpenLayers.Util.upperCaseObject(newParams);
@@ -224,15 +269,16 @@ OpenLayers.Layer.WMS.Untiled.prototype =
this.moveTo(null, true); this.moveTo(null, true);
}, },
/** combine the layer's url with its params and these newParams. /**
* APIMethod: getFullRequestString
* combine the layer's url with its params and these newParams.
* *
* Add the SRS parameter from 'projection' -- this is probably * Add the SRS parameter from 'projection' -- this is probably
* more eloquently done via a setProjection() method, but this * more eloquently done via a setProjection() method, but this
* works for now and always. * works for now and always.
* *
* @param {Object} newParams * Parameters:
* * newParams - {Object}
* @type String
*/ */
getFullRequestString:function(newParams) { getFullRequestString:function(newParams) {
var projection = this.map.getProjection(); var projection = this.map.getProjection();
+43 -11
View File
@@ -4,9 +4,12 @@
/** /**
* @class
*
* @requires OpenLayers/Layer/Grid.js * @requires OpenLayers/Layer/Grid.js
*
* Class: OpenLayers.Layer.WorldWind
*
* Inherits from:
* - <OpenLayers.Layer.Grid>
*/ */
OpenLayers.Layer.WorldWind = OpenLayers.Class.create(); OpenLayers.Layer.WorldWind = OpenLayers.Class.create();
OpenLayers.Layer.WorldWind.prototype = OpenLayers.Layer.WorldWind.prototype =
@@ -15,17 +18,36 @@ OpenLayers.Layer.WorldWind.prototype =
DEFAULT_PARAMS: { DEFAULT_PARAMS: {
}, },
/** WorldWind layer is always a base layer /**
* * APIProperty: isBaseLayer
* @type Boolean * WorldWind layer is a base layer by default.
*/ */
isBaseLayer: true, isBaseLayer: true,
// LevelZeroTileSizeDegrees
/**
* APIProperty: lzd
* LevelZeroTileSizeDegrees
*/
lzd: null, lzd: null,
/**
* APIProperty: zoomLevels
* Number of zoom levels.
*/
zoomLevels: null, zoomLevels: null,
/**
* Constructor: OpenLayers.Layer.WorldWind
*
* Parameters:
* name - {String} Name of Layer
* url - {String} Base URL
* lzd - {Float} Level zero tile size degrees
* zoomLevels - {Int} number of zoom levels
* params - {Object} additional parameters
* options - {Object} additional options
*/
initialize: function(name, url, lzd, zoomLevels, params, options) { initialize: function(name, url, lzd, zoomLevels, params, options) {
this.lzd = lzd; this.lzd = lzd;
this.zoomLevels = zoomLevels; this.zoomLevels = zoomLevels;
@@ -40,6 +62,9 @@ OpenLayers.Layer.WorldWind.prototype =
); );
} }
}, },
/**
* Method: addTile
*/
addTile:function(bounds,position) { addTile:function(bounds,position) {
if (this.map.getResolution() <= (this.lzd/512) if (this.map.getResolution() <= (this.lzd/512)
&& this.getZoom() <= this.zoomLevels) { && this.getZoom() <= this.zoomLevels) {
@@ -53,6 +78,10 @@ OpenLayers.Layer.WorldWind.prototype =
} }
}, },
/**
* Method: getZoom
* Convert map zoom to WW zoom.
*/
getZoom: function () { getZoom: function () {
var zoom = this.map.getZoom(); var zoom = this.map.getZoom();
var extent = this.map.getMaxExtent(); var extent = this.map.getMaxExtent();
@@ -61,12 +90,15 @@ OpenLayers.Layer.WorldWind.prototype =
}, },
/** /**
* @param {OpenLayers.Bounds} bounds * Method: getURL
* *
* @returns A string with the layer's url and parameters and also the * Parameters:
* bounds - {<OpenLayers.Bounds>}
*
* Returns:
* {String} A string with the layer's url and parameters and also the
* passed-in bounds and appropriate tile size specified as * passed-in bounds and appropriate tile size specified as
* parameters * parameters
* @type String
*/ */
getURL: function (bounds) { getURL: function (bounds) {
bounds = this.adjustBounds(bounds); bounds = this.adjustBounds(bounds);
+126 -69
View File
@@ -4,35 +4,51 @@
/** /**
* @class
*
* @requires OpenLayers/Layer/EventPane.js * @requires OpenLayers/Layer/EventPane.js
* @requires OpenLayers/Layer/FixedZoomLevels.js * @requires OpenLayers/Layer/FixedZoomLevels.js
*
* Class: OpenLayers.Layer.Yahoo
*
* Inherits:
* - <OpenLayers.Layer.EventPane>
* - <OpenLayers.Layer.FixedZoomLevels>v
*/ */
OpenLayers.Layer.Yahoo = OpenLayers.Class.create(); OpenLayers.Layer.Yahoo = OpenLayers.Class.create();
OpenLayers.Layer.Yahoo.prototype = OpenLayers.Layer.Yahoo.prototype =
OpenLayers.Class.inherit( OpenLayers.Layer.EventPane, OpenLayers.Class.inherit( OpenLayers.Layer.EventPane,
OpenLayers.Layer.FixedZoomLevels, { OpenLayers.Layer.FixedZoomLevels, {
/** @final @type int */ /**
* Constant: MIN_ZOOM_LEVEL
* {Integer} 0
*/
MIN_ZOOM_LEVEL: 0, MIN_ZOOM_LEVEL: 0,
/** @final @type int */ /**
* Constant: MAX_ZOOM_LEVEL
* {Integer} 15
*/
MAX_ZOOM_LEVEL: 15, MAX_ZOOM_LEVEL: 15,
/** Hardcode these resolutions so that they are more closely /**
* tied with the standard wms projection * Constant: RESOLUTIONS
* * {Array(Float)} Hardcode these resolutions so that they are more closely
* @final @type Array(float) */ * tied with the standard wms projection
*/
RESOLUTIONS: [1.40625,0.703125,0.3515625,0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.001373291015625,0.0006866455078125,0.00034332275390625,0.000171661376953125,0.0000858306884765625,0.00004291534423828125], RESOLUTIONS: [1.40625,0.703125,0.3515625,0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.001373291015625,0.0006866455078125,0.00034332275390625,0.000171661376953125,0.0000858306884765625,0.00004291534423828125],
/** @type YahooMapType */ /**
* APIProperty: type
* {YahooMapType}
*/
type: null, type: null,
/** /**
* @constructor * Constructor: OpenLayers.Layer.Yahoo
* *
* @param {String} name * Parameters:
* name - {String}
* options - {Object}
*/ */
initialize: function(name, options) { initialize: function(name, options) {
OpenLayers.Layer.EventPane.prototype.initialize.apply(this, arguments); OpenLayers.Layer.EventPane.prototype.initialize.apply(this, arguments);
@@ -41,7 +57,7 @@ OpenLayers.Layer.Yahoo.prototype =
}, },
/** /**
* * Method: loadMapObject
*/ */
loadMapObject:function() { loadMapObject:function() {
try { //do not crash! try { //do not crash!
@@ -50,11 +66,14 @@ OpenLayers.Layer.Yahoo.prototype =
}, },
/** Overridden from EventPane because we need to remove this yahoo event /**
* pane which prohibits our drag and drop, and we can only do this * APIMethod: setMap
* once the map has been loaded and centered. * Overridden from EventPane because we need to remove this yahoo event
* pane which prohibits our drag and drop, and we can only do this
* once the map has been loaded and centered.
* *
* @param {OpenLayers.Map} map * Parameters:
* map - {<OpenLayers.Map>}
*/ */
setMap: function(map) { setMap: function(map) {
OpenLayers.Layer.EventPane.prototype.setMap.apply(this, arguments); OpenLayers.Layer.EventPane.prototype.setMap.apply(this, arguments);
@@ -62,10 +81,10 @@ OpenLayers.Layer.Yahoo.prototype =
this.map.events.register("moveend", this, this.fixYahooEventPane); this.map.events.register("moveend", this, this.fixYahooEventPane);
}, },
/** The map has been centered, so the mysterious yahoo eventpane has been /**
* added. we remove it so that it doesnt mess with *our* event pane. * Method: fixYahooEventPane
* * The map has been centered, so the mysterious yahoo eventpane has been
* @private * added. we remove it so that it doesnt mess with *our* event pane.
*/ */
fixYahooEventPane: function() { fixYahooEventPane: function() {
var yahooEventPane = OpenLayers.Util.getElement("ygddfdiv"); var yahooEventPane = OpenLayers.Util.getElement("ygddfdiv");
@@ -79,9 +98,11 @@ OpenLayers.Layer.Yahoo.prototype =
}, },
/** /**
* @return String with information on why layer is broken, how to get * APIMethod: getWarningHTML
*
* Return:
* {String} String with information on why layer is broken, how to get
* it working. * it working.
* @type String
*/ */
getWarningHTML:function() { getWarningHTML:function() {
@@ -118,11 +139,14 @@ OpenLayers.Layer.Yahoo.prototype =
// //
/** /**
* @param {int} gZoom * APIMethod: getOLZoomFromMapObjectZoom
* *
* @returns An OpenLayers Zoom level, translated from the passed in gZoom * Parameters:
* Returns null if null value is passed in * gZoom - {Integer}
* @type int *
* Return:
* {Integer} An OpenLayers Zoom level, translated from the passed in gZoom
* Returns null if null value is passed in.
*/ */
getOLZoomFromMapObjectZoom: function(moZoom) { getOLZoomFromMapObjectZoom: function(moZoom) {
var zoom = null; var zoom = null;
@@ -134,11 +158,14 @@ OpenLayers.Layer.Yahoo.prototype =
}, },
/** /**
* @param {int} olZoom * APIMethod: getMapObjectZoomFromOLZoom
* *
* @returns A MapObject level, translated from the passed in olZoom * Parameters:
* Returns null if null value is passed in * olZoom - {Integer}
* @type int *
* Return:
* {Integer} A MapObject level, translated from the passed in olZoom
* Returns null if null value is passed in
*/ */
getMapObjectZoomFromOLZoom: function(olZoom) { getMapObjectZoomFromOLZoom: function(olZoom) {
var zoom = null; var zoom = null;
@@ -158,26 +185,33 @@ OpenLayers.Layer.Yahoo.prototype =
// Get&Set Center, Zoom // Get&Set Center, Zoom
/** Set the mapObject to the specified center and zoom /**
* APIMethod: setMapObjectCenter
* Set the mapObject to the specified center and zoom
* *
* @param {Object} center MapObject LonLat format * Parameters:
* @param {int} zoom MapObject zoom format * center - {Object} MapObject LonLat format
* zoom - {int} MapObject zoom format
*/ */
setMapObjectCenter: function(center, zoom) { setMapObjectCenter: function(center, zoom) {
this.mapObject.drawZoomAndCenter(center, zoom); this.mapObject.drawZoomAndCenter(center, zoom);
}, },
/** /**
* @returns the mapObject's current center in Map Object format * APIMethod: getMapObjectCenter
* @type Object *
* Return:
* {Object} The mapObject's current center in Map Object format
*/ */
getMapObjectCenter: function() { getMapObjectCenter: function() {
return this.mapObject.getCenterLatLon(); return this.mapObject.getCenterLatLon();
}, },
/** /**
* @returns the mapObject's current zoom, in Map Object format * APIMethod: getMapObjectZoom
* @type int *
* Return:
* {Integer} The mapObject's current zoom, in Map Object format
*/ */
getMapObjectZoom: function() { getMapObjectZoom: function() {
return this.mapObject.getZoomLevel(); return this.mapObject.getZoomLevel();
@@ -186,21 +220,27 @@ OpenLayers.Layer.Yahoo.prototype =
// LonLat - Pixel Translation // LonLat - Pixel Translation
/** /**
* @param {Object} moPixel MapObject Pixel format * APIMethod: getMapObjectLonLatFromMapObjectPixel
* *
* @returns MapObject LonLat translated from MapObject Pixel * Parameters:
* @type Object * moPixel - {Object} MapObject Pixel format
*
* Return:
* {Object} MapObject LonLat translated from MapObject Pixel
*/ */
getMapObjectLonLatFromMapObjectPixel: function(moPixel) { getMapObjectLonLatFromMapObjectPixel: function(moPixel) {
return this.mapObject.convertXYLatLon(moPixel); return this.mapObject.convertXYLatLon(moPixel);
}, },
/** /**
* @param {Object} moPixel MapObject Pixel format * APIMethod: getMapObjectPixelFromMapObjectLonLat
* *
* @returns MapObject Pixel translated from MapObject LonLat * Parameters:
* @type Object * moLonLat - {Object} MapObject LonLat format
*
* Return:
* {Object} MapObject Pixel transtlated from MapObject LonLat
*/ */
getMapObjectPixelFromMapObjectLonLat: function(moLonLat) { getMapObjectPixelFromMapObjectLonLat: function(moLonLat) {
return this.mapObject.convertLatLonXY(moLonLat); return this.mapObject.convertLatLonXY(moLonLat);
@@ -217,31 +257,40 @@ OpenLayers.Layer.Yahoo.prototype =
// LonLat // LonLat
/** /**
* @param {Object} moLonLat MapObject LonLat format * APIMethod: getLongitudeFromMapObjectLonLat
* *
* @returns Longitude of the given MapObject LonLat * Parameters:
* @type float * moLonLat - {Object} MapObject LonLat format
*
* Return:
* {Float} Longitude of the given MapObject LonLat
*/ */
getLongitudeFromMapObjectLonLat: function(moLonLat) { getLongitudeFromMapObjectLonLat: function(moLonLat) {
return moLonLat.Lon; return moLonLat.Lon;
}, },
/** /**
* @param {Object} moLonLat MapObject LonLat format * APIMethod: getLatitudeFromMapObjectLonLat
* *
* @returns Latitude of the given MapObject LonLat * Parameters:
* @type float * moLonLat - {Object} MapObject LonLat format
*
* Return:
* {Float} Latitude of the given MapObject LonLat
*/ */
getLatitudeFromMapObjectLonLat: function(moLonLat) { getLatitudeFromMapObjectLonLat: function(moLonLat) {
return moLonLat.Lat; return moLonLat.Lat;
}, },
/** /**
* @param {int} lon float * APIMethod: getMapObjectLonLatFromLonLat
* @param {int} lat float
* *
* @returns MapObject LonLat built from lon and lat params * Parameters:
* @type Object * lon - {Float}
* lat - {Float}
*
* Return:
* {Object} MapObject LonLat built from lon and lat params
*/ */
getMapObjectLonLatFromLonLat: function(lon, lat) { getMapObjectLonLatFromLonLat: function(lon, lat) {
return new YGeoPoint(lat, lon); return new YGeoPoint(lat, lon);
@@ -249,38 +298,46 @@ OpenLayers.Layer.Yahoo.prototype =
// Pixel // Pixel
/** /**
* @param {Object} moPixel MapObject Pixel format * APIMethod: getXFromMapObjectPixel
* *
* @returns X value of the MapObject Pixel * Parameters:
* @type int * moPixel - {Object} MapObject Pixel format
*
* Return:
* {Integer} X value of the MapObject Pixel
*/ */
getXFromMapObjectPixel: function(moPixel) { getXFromMapObjectPixel: function(moPixel) {
return moPixel.x; return moPixel.x;
}, },
/** /**
* @param {Object} moPixel MapObject Pixel format * APIMethod: getYFromMapObjectPixel
* *
* @returns Y value of the MapObject Pixel * Parameters:
* @type int * moPixel - {Object} MapObject Pixel format
*
* Return:
* {Integer} Y value of the MapObject Pixel
*/ */
getYFromMapObjectPixel: function(moPixel) { getYFromMapObjectPixel: function(moPixel) {
return moPixel.y; return moPixel.y;
}, },
/** /**
* @param {int} x * APIMethod: getMapObjectPixelFromXY
* @param {int} y
* *
* @returns MapObject Pixel from x and y parameters * Parameters:
* @type Object * x - {Integer}
* y - {Integer}
*
* Return:
* {Object} MapObject Pixel from x and y parameters
*/ */
getMapObjectPixelFromXY: function(x, y) { getMapObjectPixelFromXY: function(x, y) {
return new YCoordPoint(x, y); return new YCoordPoint(x, y);
}, },
/** @final @type String */ /** @final @type String */
CLASS_NAME: "OpenLayers.Layer.Yahoo" CLASS_NAME: "OpenLayers.Layer.Yahoo"
}); });
+518 -277
View File
File diff suppressed because it is too large Load Diff
+67 -32
View File
@@ -4,32 +4,46 @@
/** /**
* @class
* @requires OpenLayers/Events.js * @requires OpenLayers/Events.js
* @requires OpenLayers/Icon.js * @requires OpenLayers/Icon.js
*
* Class: OpenLayers.Marker
* Instances of OpenLayers.Marker are a combination of a
* <OpenLayers.LonLat> and an <OpenLayers.Icon>.
*/ */
OpenLayers.Marker = OpenLayers.Class.create(); OpenLayers.Marker = OpenLayers.Class.create();
OpenLayers.Marker.prototype = { OpenLayers.Marker.prototype = {
/** @type OpenLayers.Icon */ /**
icon: null, * Property: icon
* {<OpenLayers.Icon>}
*/
icon: null,
/** location of object /**
* @type OpenLayers.LonLat */ * Property: lonlat
lonlat: null, * {<OpenLayers.LonLat>} location of object
*/
/** @type OpenLayers.Events*/ lonlat: null,
events: null,
/** @type OpenLayers.Map */
map: null,
/** /**
* @constructor * Property: events
* * {<OpenLayers.Events>}
* @param {OpenLayers.Icon} icon */
* @param {OpenLayers.LonLat lonlat events: null,
*/
/**
* Property: map
* {<OpenLayers.Map>}
*/
map: null,
/**
* Constructor: OpenLayers.Marker
* Paraemeters:
* icon - {<OpenLayers.Icon>}
* lonlat - {<OpenLayers.LonLat>}
*/
initialize: function(lonlat, icon) { initialize: function(lonlat, icon) {
this.lonlat = lonlat; this.lonlat = lonlat;
@@ -58,18 +72,26 @@ OpenLayers.Marker.prototype = {
}, },
/** /**
* @param {OpenLayers.Pixel} px * Method: draw
* Calls draw on the icon, and returns that output.
* *
* @return A new DOM Image with this marker's icon set at the * Parameters:
* location passed-in * px - {<OpenLayers.Pixel>}
* @type DOMElement *
* Return:
* {DOMElement} A new DOM Image with this marker's icon set at the
* location passed-in
*/ */
draw: function(px) { draw: function(px) {
return this.icon.draw(px); return this.icon.draw(px);
}, },
/** /**
* @param {OpenLayers.Pixel} px * Method: moveTo
* Move the marker to the new location.
*
* Parameters:
* px - {<OpenLayers.Pixel>}
*/ */
moveTo: function (px) { moveTo: function (px) {
if ((px != null) && (this.icon != null)) { if ((px != null) && (this.icon != null)) {
@@ -79,8 +101,10 @@ OpenLayers.Marker.prototype = {
}, },
/** /**
* @returns Whether or not the marker is currently visible on screen. * Method: onScreen
* @type Boolean *
* Return:
* {Boolean} Whether or not the marker is currently visible on screen.
*/ */
onScreen:function() { onScreen:function() {
@@ -93,7 +117,10 @@ OpenLayers.Marker.prototype = {
}, },
/** /**
* @param {float} inflate * Method: inflate
*
* Parameters:
* inflate - {float}
*/ */
inflate: function(inflate) { inflate: function(inflate) {
if (this.icon) { if (this.icon) {
@@ -103,18 +130,23 @@ OpenLayers.Marker.prototype = {
} }
}, },
/** Change the opacity of the marker by changin the opacity of /**
* Method: setOpacity
* Change the opacity of the marker by changin the opacity of
* its icon * its icon
* *
* @param {float} opacity Specified as fraction (0.4, etc) * Parameters:
* opacity - {float} Specified as fraction (0.4, etc)
*/ */
setOpacity: function(opacity) { setOpacity: function(opacity) {
this.icon.setOpacity(opacity); this.icon.setOpacity(opacity);
}, },
/** Hide or show the icon /**
* Method: display
* Hide or show the icon
* *
* @param {Boolean} display * display - {Boolean}
*/ */
display: function(display) { display: function(display) {
this.icon.display(display); this.icon.display(display);
@@ -125,9 +157,12 @@ OpenLayers.Marker.prototype = {
}; };
/** /**
* @returns A default OpenLayers.Icon to use for a marker * Function: defaultIcon
* @type OpenLayers.Icon * Creates a default <OpenLayers.Icon>.
*
* Returns:
* {<OpenLayers.Icon>} A default OpenLayers.Icon to use for a marker
*/ */
OpenLayers.Marker.defaultIcon = function() { OpenLayers.Marker.defaultIcon = function() {
var url = OpenLayers.Util.getImagesLocation() + "marker.png"; var url = OpenLayers.Util.getImagesLocation() + "marker.png";
+43 -22
View File
@@ -4,26 +4,36 @@
/** /**
* @class
*
* @requires OpenLayers/Marker.js * @requires OpenLayers/Marker.js
*
* Class: OpenLayers.Marker.Box
*
* Inherits from:
* - <OpenLayers.Marker>
*/ */
OpenLayers.Marker.Box = OpenLayers.Class.create(); OpenLayers.Marker.Box = OpenLayers.Class.create();
OpenLayers.Marker.Box.prototype = OpenLayers.Marker.Box.prototype =
OpenLayers.Class.inherit( OpenLayers.Marker, { OpenLayers.Class.inherit( OpenLayers.Marker, {
/** @type OpenLayers.Bounds */ /**
bounds: null, * Property: bounds
* {<OpenLayers.Bounds>}
*/
bounds: null,
/** @type DOMElement */ /**
div: null, * Property: div
* {DOMElement}
*/
div: null,
/** /**
* @constructor * Constructor: OpenLayers.Marker.Box
* *
* @param {OpenLayers.Bounds} bounds * Parameters:
* @param {String} borderColor * bounds - {<OpenLayers.Bounds>}
* @param {int} borderWidth * borderColor - {String}
* borderWidth - {int}
*/ */
initialize: function(bounds, borderColor, borderWidth) { initialize: function(bounds, borderColor, borderWidth) {
this.bounds = bounds; this.bounds = bounds;
@@ -34,7 +44,7 @@ OpenLayers.Marker.Box.prototype =
}, },
/** /**
* * Method: destroy
*/ */
destroy: function() { destroy: function() {
@@ -44,10 +54,13 @@ OpenLayers.Marker.Box.prototype =
OpenLayers.Marker.prototype.destroy.apply(this, arguments); OpenLayers.Marker.prototype.destroy.apply(this, arguments);
}, },
/** Allow the user to change the box's color and border width /**
* Method: setBorder
* Allow the user to change the box's color and border width
* *
* @param {String} color Default is "red" * Parameters:
* @param {int} width Default is 2 * color - {String} Default is "red"
* width - {int} Default is 2
*/ */
setBorder: function (color, width) { setBorder: function (color, width) {
if (!color) { if (!color) {
@@ -60,12 +73,15 @@ OpenLayers.Marker.Box.prototype =
}, },
/** /**
* @param {OpenLayers.Pixel} px * Method: draw
* @param {OpenLayers.Size} sz
* *
* @return A new DOM Image with this marker´s icon set at the * Parameters:
* px - {<OpenLayers.Pixel>}
* sz - {<OpenLayers.Size>}
*
* Return:
* {DOMElement} A new DOM Image with this marker´s icon set at the
* location passed-in * location passed-in
* @type DOMElement
*/ */
draw: function(px, sz) { draw: function(px, sz) {
OpenLayers.Util.modifyDOMElement(this.div, null, px, sz); OpenLayers.Util.modifyDOMElement(this.div, null, px, sz);
@@ -73,8 +89,10 @@ OpenLayers.Marker.Box.prototype =
}, },
/** /**
* @returns Whether or not the marker is currently visible on screen. * Method: onScreen
* @type Boolean *
* Rreturn:
* {Boolean} Whether or not the marker is currently visible on screen.
*/ */
onScreen:function() { onScreen:function() {
var onScreen = false; var onScreen = false;
@@ -85,9 +103,12 @@ OpenLayers.Marker.Box.prototype =
return onScreen; return onScreen;
}, },
/** Hide or show the icon /**
* Method: display
* Hide or show the icon
* *
* @param {Boolean} display * Parameters:
* display - {Boolean}
*/ */
display: function(display) { display: function(display) {
this.div.style.display = (display) ? "" : "none"; this.div.style.display = (display) ? "" : "none";
+160 -75
View File
@@ -4,7 +4,7 @@
/** /**
* @class * Class: OpenLayers.Popup
*/ */
OpenLayers.Popup = OpenLayers.Class.create(); OpenLayers.Popup = OpenLayers.Class.create();
@@ -16,55 +16,94 @@ OpenLayers.Popup.BORDER = "0px";
OpenLayers.Popup.prototype = { OpenLayers.Popup.prototype = {
/** @type OpenLayers.Events*/ /**
events: null, * Property: events
* {<OpenLayers.Events>}
*/
events: null,
/** @type String */ /** Property: id
* {String}
*/
id: "", id: "",
/** @type OpenLayers.LonLat */ /**
lonlat: null, * Property: lonlat
* {<OpenLayers.LonLat>}
/** @type DOMElement */ */
div: null, lonlat: null,
/** @type OpenLayers.Size*/
size: null,
/** @type String */
contentHTML: "",
/** @type String */
backgroundColor: "",
/** @type float */
opacity: "",
/** @type String */
border: "",
/** @type DOMElement */
contentDiv:null,
/** @type DOMElement */
groupDiv:null,
/** @type int */
padding: 5,
/** this gets set in Map.js when the popup is added to the map
* @type OpenLayers.Map */
map: null,
/** /**
* @constructor * Property: div
* {DOMElement}
*/
div: null,
/**
* Property: size
* {<OpenLayers.Size>}
*/
size: null,
/**
* Property: contentHTML
* {String}
*/
contentHTML: "",
/**
* Property: backgroundColor
* {String}
*/
backgroundColor: "",
/**
* Property: opacity
* {float}
*/
opacity: "",
/**
* Property: border
* {String}
*/
border: "",
/**
* Property: contentDiv
* {DOMElement}
*/
contentDiv: null,
/**
* Property: groupDiv
* {DOMElement}
*/
groupDiv: null,
/**
* Property: padding
* {int}
*/
padding: 5,
/**
* Property: map
* {<OpenLayers.Map>} this gets set in Map.js when the popup is added to the map
*/
map: null,
/**
* Constructor: OpenLayers.Popup
* Create a popup.
* *
* @param {String} id * Parameters:
* @param {OpenLayers.LonLat} lonlat * id - {String}
* @param {OpenLayers.Size} size * lonlat - {<OpenLayers.LonLat>}
* @param {String} contentHTML * size - {<OpenLayers.Size>}
* @param {Boolean} closeBox * contentHTML - {String}
* closeBox - {Boolean}
*/ */
initialize:function(id, lonlat, size, contentHTML, closeBox) { initialize:function(id, lonlat, size, contentHTML, closeBox) {
if (id == null) { if (id == null) {
@@ -125,7 +164,9 @@ OpenLayers.Popup.prototype = {
}, },
/** /**
*/ * Method: destroy
* nullify references to prevent circular references and memory leaks
*/
destroy: function() { destroy: function() {
if (this.map != null) { if (this.map != null) {
this.map.removePopup(this); this.map.removePopup(this);
@@ -137,10 +178,13 @@ OpenLayers.Popup.prototype = {
}, },
/** /**
* @param {OpenLayers.Pixel} px * method: draw
* *
* @returns Reference to a div that contains the drawn popup * Parameters:
* @type DOMElement * px - {<OpenLayers.Pixel>}
*
* Return:
* {DOMElement} Reference to a div that contains the drawn popup
*/ */
draw: function(px) { draw: function(px) {
if (px == null) { if (px == null) {
@@ -160,8 +204,9 @@ OpenLayers.Popup.prototype = {
}, },
/** /**
* Method: updatePosition
* if the popup has a lonlat and its map members set, * if the popup has a lonlat and its map members set,
* then have it move itself to its proper position * then have it move itself to its proper position
*/ */
updatePosition: function() { updatePosition: function() {
if ((this.lonlat) && (this.map)) { if ((this.lonlat) && (this.map)) {
@@ -171,7 +216,10 @@ OpenLayers.Popup.prototype = {
}, },
/** /**
* @param {OpenLayers.Pixel} px * Method: moveTo
*
* Parameters:
* px - {<OpenLayers.Pixel>}
*/ */
moveTo: function(px) { moveTo: function(px) {
if ((px != null) && (this.div != null)) { if ((px != null) && (this.div != null)) {
@@ -181,36 +229,41 @@ OpenLayers.Popup.prototype = {
}, },
/** /**
* @returns Boolean indicating whether or not the popup is visible * method: visible
* @type Boolean *
* Returns:
* {Boolean} Boolean indicating whether or not the popup is visible
*/ */
visible: function() { visible: function() {
return OpenLayers.Element.visible(this.div); return OpenLayers.Element.visible(this.div);
}, },
/** /**
* * Method: toggle
*/ */
toggle: function() { toggle: function() {
OpenLayers.Element.toggle(this.div); OpenLayers.Element.toggle(this.div);
}, },
/** /**
* * Method: show
*/ */
show: function() { show: function() {
OpenLayers.Element.show(this.div); OpenLayers.Element.show(this.div);
}, },
/** /**
* * Method: hide
*/ */
hide: function() { hide: function() {
OpenLayers.Element.hide(this.div); OpenLayers.Element.hide(this.div);
}, },
/** /**
* @param {OpenLayers.Size} size * Method: setSize
*
* Parameters:
* size - {<OpenLayers.Size>}
*/ */
setSize:function(size) { setSize:function(size) {
if (size != undefined) { if (size != undefined) {
@@ -228,7 +281,10 @@ OpenLayers.Popup.prototype = {
}, },
/** /**
* @param {String} color * Method: setBackgroundColor
*
* Parameters:
* color - {String}
*/ */
setBackgroundColor:function(color) { setBackgroundColor:function(color) {
if (color != undefined) { if (color != undefined) {
@@ -241,7 +297,10 @@ OpenLayers.Popup.prototype = {
}, },
/** /**
* @param {float} opacity * Method: setOpacity
*
* Parameters:
* opacity - {float}
*/ */
setOpacity:function(opacity) { setOpacity:function(opacity) {
if (opacity != undefined) { if (opacity != undefined) {
@@ -258,7 +317,10 @@ OpenLayers.Popup.prototype = {
}, },
/** /**
* @param {int} border * Method: setBorder
*
* Parameters:
* border - {int}
*/ */
setBorder:function(border) { setBorder:function(border) {
if (border != undefined) { if (border != undefined) {
@@ -271,7 +333,10 @@ OpenLayers.Popup.prototype = {
}, },
/** /**
* @param {String} contentHTML * Method: setContentHTML
*
* Parameters:
* contentHTML - {String}
*/ */
setContentHTML:function(contentHTML) { setContentHTML:function(contentHTML) {
if (contentHTML != null) { if (contentHTML != null) {
@@ -285,7 +350,11 @@ OpenLayers.Popup.prototype = {
/** Do this in a separate function so that subclasses can /**
* Method: registerEvents
* Registers events on the popup.
*
* Do this in a separate function so that subclasses can
* choose to override it if they wish to deal differently * choose to override it if they wish to deal differently
* with mouse events * with mouse events
* *
@@ -313,22 +382,28 @@ OpenLayers.Popup.prototype = {
this.events.register("dblclick", this, this.ondblclick); this.events.register("dblclick", this, this.ondblclick);
}, },
/** When mouse goes down within the popup, make a note of /**
* Method: onmousedown
* When mouse goes down within the popup, make a note of
* it locally, and then do not propagate the mousedown * it locally, and then do not propagate the mousedown
* (but do so safely so that user can select text inside) * (but do so safely so that user can select text inside)
* *
* @param {Event} evt * Parameters:
* evt - {Event}
*/ */
onmousedown: function (evt) { onmousedown: function (evt) {
this.mousedown = true; this.mousedown = true;
OpenLayers.Event.stop(evt, true); OpenLayers.Event.stop(evt, true);
}, },
/** If the drag was started within the popup, then /**
* Method: onmousemove
* If the drag was started within the popup, then
* do not propagate the mousemove (but do so safely * do not propagate the mousemove (but do so safely
* so that user can select text inside) * so that user can select text inside)
* *
* @param {Event} evt * Parameters:
* evt - {Event}
*/ */
onmousemove: function (evt) { onmousemove: function (evt) {
if (this.mousedown) { if (this.mousedown) {
@@ -336,12 +411,15 @@ OpenLayers.Popup.prototype = {
} }
}, },
/** When mouse comes up within the popup, after going down /**
* Method: onmouseup
* When mouse comes up within the popup, after going down
* in it, reset the flag, and then (once again) do not * in it, reset the flag, and then (once again) do not
* propagate the event, but do so safely so that user can * propagate the event, but do so safely so that user can
* select text inside * select text inside
* *
* @param {Event} evt * Parameters:
* evt - {Event}
*/ */
onmouseup: function (evt) { onmouseup: function (evt) {
if (this.mousedown) { if (this.mousedown) {
@@ -350,28 +428,35 @@ OpenLayers.Popup.prototype = {
} }
}, },
/** Ignore clicks, but allowing default browser handling /**
* Method: onclick
* Ignore clicks, but allowing default browser handling
* *
* @param {Event} evt * Parameters:
* evt - {Event}
*/ */
onclick: function (evt) { onclick: function (evt) {
OpenLayers.Event.stop(evt, true); OpenLayers.Event.stop(evt, true);
}, },
/** When mouse goes out of the popup set the flag to false so that /**
* Method: onmouseout
* When mouse goes out of the popup set the flag to false so that
* if they let go and then drag back in, we won't be confused. * if they let go and then drag back in, we won't be confused.
* *
* @param {Event} evt * Parameters:
* * evt - {Event}
* @type Boolean
*/ */
onmouseout: function (evt) { onmouseout: function (evt) {
this.mousedown = false; this.mousedown = false;
}, },
/** Ignore double-clicks, but allowing default browser handling /**
* Method: ondblclick
* Ignore double-clicks, but allowing default browser handling
* *
* @param {Event} evt * Parameters:
* evt - {Event}
*/ */
ondblclick: function (evt) { ondblclick: function (evt) {
OpenLayers.Event.stop(evt, true); OpenLayers.Event.stop(evt, true);
+52 -31
View File
@@ -4,35 +4,44 @@
/** /**
* @class
*
* @requires OpenLayers/Popup.js * @requires OpenLayers/Popup.js
*
* Class: OpenLayers.Popup.Anchored
*
* Inherits from:
* - <OpenLayers.Popup>
*/ */
OpenLayers.Popup.Anchored = OpenLayers.Class.create(); OpenLayers.Popup.Anchored = OpenLayers.Class.create();
OpenLayers.Popup.Anchored.prototype = OpenLayers.Popup.Anchored.prototype =
OpenLayers.Class.inherit( OpenLayers.Popup, { OpenLayers.Class.inherit( OpenLayers.Popup, {
/** "lr", "ll", "tr", "tl" - relative position of the popup. /**
* @type String */ * Parameter: relativePosition
* {String} Relative position of the popup ("lr", "ll", "tr", or "tl")
*/
relativePosition: null, relativePosition: null,
/** Object which must have expose a 'size' (OpenLayers.Size) and /**
* 'offset' (OpenLayers.Pixel) * Parameter: anchor
* @type Object */ * {Object} Object to which we'll anchor the popup.
* Must expose a 'size' (<OpenLayers.Size>) and
* 'offset' (<OpenLayers.Pixel>)
*/
anchor: null, anchor: null,
/** /**
* @constructor * Constructor: OpenLayers.Popup.Anchored
* *
* @param {String} id * Parameters:
* @param {OpenLayers.LonLat} lonlat * id - {String}
* @param {OpenLayers.Size} size * lonlat - {<OpenLayers.LonLat>}
* @param {String} contentHTML * size - {<OpenLayers.Size>}
* @param {Object} anchor Object which must expose a * contentHTML - {String}
* anchor - {Object} Object which must expose a
* - 'size' (OpenLayers.Size) and * - 'size' (OpenLayers.Size) and
* - 'offset' (OpenLayers.Pixel) * - 'offset' (OpenLayers.Pixel)
* (this is generally an OpenLayers.Icon) * (this is generally an OpenLayers.Icon)
* @param {Boolean} closeBox * closeBox - {Boolean}
*/ */
initialize:function(id, lonlat, size, contentHTML, anchor, closeBox) { initialize:function(id, lonlat, size, contentHTML, anchor, closeBox) {
var newArguments = new Array(id, lonlat, size, contentHTML, closeBox); var newArguments = new Array(id, lonlat, size, contentHTML, closeBox);
@@ -44,11 +53,14 @@ OpenLayers.Popup.Anchored.prototype =
}, },
/** /**
* @param {OpenLayers.Pixel} px * Method: draw
* *
* @returns Reference to a div that contains the drawn popup * Parameters:
* @type DOMElement * px - {<OpenLayers.Pixel>}
*/ *
* Return:
* {DOMElement} Reference to a div that contains the drawn popup
*/
draw: function(px) { draw: function(px) {
if (px == null) { if (px == null) {
if ((this.lonlat != null) && (this.map != null)) { if ((this.lonlat != null) && (this.map != null)) {
@@ -63,13 +75,14 @@ OpenLayers.Popup.Anchored.prototype =
}, },
/** /**
* @private * Method: calculateRelativePosition
* *
* @param {OpenLayers.Pixel} px * Parameters:
* px - {<OpenLayers.Pixel>}
* *
* @returns The relative position ("br" "tr" "tl "bl") at which the popup * Return:
* should be placed * {String} The relative position ("br" "tr" "tl "bl") at which the popup
* @type String * should be placed
*/ */
calculateRelativePosition:function(px) { calculateRelativePosition:function(px) {
var lonlat = this.map.getLonLatFromLayerPx(px); var lonlat = this.map.getLonLatFromLayerPx(px);
@@ -81,7 +94,10 @@ OpenLayers.Popup.Anchored.prototype =
}, },
/** /**
* @param {OpenLayers.Pixel} px * Method: moveTo
*
* Parameters:
* px - {<OpenLayers.Pixel>}
*/ */
moveTo: function(px) { moveTo: function(px) {
@@ -92,7 +108,10 @@ OpenLayers.Popup.Anchored.prototype =
}, },
/** /**
* @param {OpenLayers.Size} size * Method: setSize
*
* Parameters:
* size - {<OpenLayers.Size>}
*/ */
setSize:function(size) { setSize:function(size) {
OpenLayers.Popup.prototype.setSize.apply(this, arguments); OpenLayers.Popup.prototype.setSize.apply(this, arguments);
@@ -104,13 +123,14 @@ OpenLayers.Popup.Anchored.prototype =
}, },
/** /**
* @private * Method: calculateNewPx
* *
* @param {OpenLayers.Pixel} px * Parameters:
* px - {<OpenLayers.Pixel>}
* *
* @returns The the new px position of the popup on the screen * Return:
* relative to the passed-in px * {<OpenLayers.Pixel>} The the new px position of the popup on the screen
* @type OpenLayers.Pixel * relative to the passed-in px
*/ */
calculateNewPx:function(px) { calculateNewPx:function(px) {
var newPx = px.offset(this.anchor.offset); var newPx = px.offset(this.anchor.offset);
@@ -124,5 +144,6 @@ OpenLayers.Popup.Anchored.prototype =
return newPx; return newPx;
}, },
/** @final @type String */
CLASS_NAME: "OpenLayers.Popup.Anchored" CLASS_NAME: "OpenLayers.Popup.Anchored"
}); });
+64 -37
View File
@@ -4,43 +4,57 @@
/** /**
* @class
*
* @requires OpenLayers/Popup/Anchored.js * @requires OpenLayers/Popup/Anchored.js
*
* Class: OpenLayers.Popup.AnchoredBubble
*
* Inherits from:
* - <OpenLayers.Popup.Anchored>
*/ */
OpenLayers.Popup.AnchoredBubble = OpenLayers.Class.create(); OpenLayers.Popup.AnchoredBubble = OpenLayers.Class.create();
//Border space for the rico corners /**
* Constant: CORNER_SIZE
* {Integer} 5. Border space for the RICO corners
*/
OpenLayers.Popup.AnchoredBubble.CORNER_SIZE = 5; OpenLayers.Popup.AnchoredBubble.CORNER_SIZE = 5;
OpenLayers.Popup.AnchoredBubble.prototype = OpenLayers.Popup.AnchoredBubble.prototype =
OpenLayers.Class.inherit( OpenLayers.Popup.Anchored, { OpenLayers.Class.inherit( OpenLayers.Popup.Anchored, {
/**
* Property: rounded
* {Boolean} Has the popup been rounded yet?
*/
rounded: false, rounded: false,
/** /**
* @constructor * Constructor: OpenLayers.Popup.AnchoredBubble
* *
* @param {String} id * Parameters:
* @param {OpenLayers.LonLat} lonlat * id - {String}
* @param {OpenLayers.Size} size * lonlat - {<OpenLayers.LonLat>}
* @param {String} contentHTML * size - {<OpenLayers.Size>}
* @param {Object} anchor Object which must expose a * contentHTML - {String}
* - 'size' (OpenLayers.Size) and * anchor {Object} Object to which we'll anchor the popup.
* - 'offset' (OpenLayers.Pixel) * Must expose a 'size' (<OpenLayers.Size>) and
* (this is generally an OpenLayers.Icon) * 'offset' (<OpenLayers.Pixel>)
* @param {Boolean} closeBox * (Note that this is generally an <OpenLayers.Icon>)
*/ * closeBox {Boolean}
*/
initialize:function(id, lonlat, size, contentHTML, anchor, closeBox) { initialize:function(id, lonlat, size, contentHTML, anchor, closeBox) {
OpenLayers.Popup.Anchored.prototype.initialize.apply(this, arguments); OpenLayers.Popup.Anchored.prototype.initialize.apply(this, arguments);
}, },
/** /**
* @param {OpenLayers.Pixel} px * Method: draw
* *
* @returns Reference to a div that contains the drawn popup * Parameters:
* @type DOMElement * px - {<OpenLayers.Pixel>}
*/ *
* Return:
* {DOMElement} Reference to a div that contains the drawn popup
*/
draw: function(px) { draw: function(px) {
OpenLayers.Popup.Anchored.prototype.draw.apply(this, arguments); OpenLayers.Popup.Anchored.prototype.draw.apply(this, arguments);
@@ -58,8 +72,11 @@ OpenLayers.Popup.AnchoredBubble.prototype =
}, },
/** /**
* @param {OpenLayers.Size} size * APIMethod: setSize
*/ *
* Parameters:
* size - {<OpenLayers.Size>}
*/
setSize:function(size) { setSize:function(size) {
OpenLayers.Popup.Anchored.prototype.setSize.apply(this, arguments); OpenLayers.Popup.Anchored.prototype.setSize.apply(this, arguments);
@@ -81,7 +98,10 @@ OpenLayers.Popup.AnchoredBubble.prototype =
}, },
/** /**
* @param {String} color * APIMethod: setBackgroundColor
*
* Parameters:
* color - {String}
*/ */
setBackgroundColor:function(color) { setBackgroundColor:function(color) {
if (color != undefined) { if (color != undefined) {
@@ -97,7 +117,10 @@ OpenLayers.Popup.AnchoredBubble.prototype =
}, },
/** /**
* @param {float} opacity * APIMethod: setOpacity
*
* Parameters:
* opacity - {float}
*/ */
setOpacity:function(opacity) { setOpacity:function(opacity) {
if (opacity != undefined) { if (opacity != undefined) {
@@ -111,22 +134,26 @@ OpenLayers.Popup.AnchoredBubble.prototype =
} }
}, },
/** Bubble Popups can not have a border /**
* Method: setBorder
* *
* @param {int} border * Always sets border to 0. Bubble Popups can not have a border.
*
* Parameters:
* border - {Integer}
*/ */
setBorder:function(border) { setBorder:function(border) {
this.border = 0; this.border = 0;
}, },
/** /**
* @private * Method: setRicoCorners
* *
* @param {Boolean} firstTime Is this the first time the corners are being * Update RICO corners according to the popup's current relative postion.
* rounded? *
* * Parameters:
* update the rico corners according to the popup's * firstTime - {Boolean} Is this the first time the corners are being
* current relative postion * rounded?
*/ */
setRicoCorners:function(firstTime) { setRicoCorners:function(firstTime) {
@@ -147,11 +174,10 @@ OpenLayers.Popup.AnchoredBubble.prototype =
}, },
/** /**
* @private * Method: getCornersToRound
* *
* @returns The proper corners string ("tr tl bl br") for rico * Return:
* to round * {String} The proper corners string ("tr tl bl br") for rico to round
* @type String
*/ */
getCornersToRound:function() { getCornersToRound:function() {
@@ -164,5 +190,6 @@ OpenLayers.Popup.AnchoredBubble.prototype =
return corners.join(" "); return corners.join(" ");
}, },
/** @final @type String */
CLASS_NAME: "OpenLayers.Popup.AnchoredBubble" CLASS_NAME: "OpenLayers.Popup.AnchoredBubble"
}); });
+70 -45
View File
@@ -3,7 +3,8 @@
* for the full text of the license. */ * for the full text of the license. */
/** /**
* @class Renderer is the base class for all renderers. * Class: Renderer
* This is the base class for all renderers.
* *
* This is based on a merger code written by Paul Spencer and Bertil Chapuis. * This is based on a merger code written by Paul Spencer and Bertil Chapuis.
* It is largely composed of virtual functions that are to be implemented * It is largely composed of virtual functions that are to be implemented
@@ -21,34 +22,48 @@
OpenLayers.Renderer = OpenLayers.Class.create(); OpenLayers.Renderer = OpenLayers.Class.create();
OpenLayers.Renderer.prototype = OpenLayers.Renderer.prototype =
{ {
/** @type DOMElement */ /**
* Property: container
* {DOMElement}
*/
container: null, container: null,
/** @type OpenLayers.Bounds */ /**
* Property: extent
* {<OpenLayers.Bounds>}
*/
extent: null, extent: null,
/** @type OpenLayers.Size */ /**
* Property: size
* {<OpenLayers.Size>}
*/
size: null, size: null,
/** cache of current map resolution /**
* @type float */ * Property: resolution
* {Float} cache of current map resolution
*/
resolution: null, resolution: null,
/** Reference to the map -- this is set in Vector's setMap() /**
* @type OpenLayers.Map */ * Property: map
* {<OpenLayers.Map>} Reference to the map -- this is set in Vector's setMap()
*/
map: null, map: null,
/** /**
* @constructor * Constructor: OpenLayers.Renderer
* *
* @param {String} containerID * Parameters:
* containerID - {<String>}
*/ */
initialize: function(containerID) { initialize: function(containerID) {
this.container = $(containerID); this.container = $(containerID);
}, },
/** /**
* * APIMethod: destroy
*/ */
destroy: function() { destroy: function() {
this.container = null; this.container = null;
@@ -59,23 +74,26 @@ OpenLayers.Renderer.prototype =
}, },
/** /**
* APIMethod: supported
* This should be overridden by specific subclasses * This should be overridden by specific subclasses
* *
* @returns Whether or not the browser supports the VML renderer * Returns:
* @type Boolean * {Boolean} Whether or not the browser supports the renderer class
*/ */
supported: function() { supported: function() {
return false; return false;
}, },
/** /**
* Method: setExtent
* Set the visible part of the layer. * Set the visible part of the layer.
* *
* Resolution has probably changed, so we nullify the resolution * Resolution has probably changed, so we nullify the resolution
* cache (this.resolution) -- this way it will be re-computed when * cache (this.resolution) -- this way it will be re-computed when
* next it is needed. * next it is needed.
* *
* @param {OpenLayers.Bounds} extent * Parameters:
* extent - {<OpenLayers.Bounds>}
*/ */
setExtent: function(extent) { setExtent: function(extent) {
this.extent = extent.clone(); this.extent = extent.clone();
@@ -83,37 +101,42 @@ OpenLayers.Renderer.prototype =
}, },
/** /**
* Method: setSize
* Sets the size of the drawing surface. * Sets the size of the drawing surface.
* *
* Resolution has probably changed, so we nullify the resolution * Resolution has probably changed, so we nullify the resolution
* cache (this.resolution) -- this way it will be re-computed when * cache (this.resolution) -- this way it will be re-computed when
* next it is needed. * next it is needed.
* *
* @param {OpenLayers.Size} size * Parameters:
* size - {<OpenLayers.Size>}
*/ */
setSize: function(size) { setSize: function(size) {
this.size = size.clone(); this.size = size.clone();
this.resolution = null; this.resolution = null;
}, },
/** Uses cached copy of resolution if available to minimize computing /**
* Method: getResolution
* Uses cached copy of resolution if available to minimize computing
* *
* @returns The current map's resolution * Returns:
* @type float * The current map's resolution
*/ */
getResolution: function() { getResolution: function() {
this.resolution = this.resolution || this.map.getResolution(); this.resolution = this.resolution || this.map.getResolution();
return this.resolution; return this.resolution;
}, },
/** /**
* Method: drawFeature
* Draw the feature. The optional style argument can be used * Draw the feature. The optional style argument can be used
* to override the feature's own style. This method should only * to override the feature's own style. This method should only
* be called from layer.drawFeature(). * be called from layer.drawFeature().
* *
* @param {OpenLayers.Feature.Vector} feature * Parameters:
* @param {Object} style * feature - {<OpenLayers.Feature.Vector>}
* @private * style - {<Object>}
*/ */
drawFeature: function(feature, style) { drawFeature: function(feature, style) {
if(style == null) { if(style == null) {
@@ -124,45 +147,47 @@ OpenLayers.Renderer.prototype =
/** /**
* virtual function * Method: drawGeometry
* *
* Draw a geometry. This should only be called from the renderer itself. * Draw a geometry. This should only be called from the renderer itself.
* Use layer.drawFeature() from outside the renderer. * Use layer.drawFeature() from outside the renderer.
* virtual function
* *
* @param geometry {OpenLayers.Geometry} * Parameters:
* @param style {Object} * geometry - {<OpenLayers.Geometry>}
* @param {String} featureId * style - {Object}
* @private * featureId - {<String>}
*/ */
drawGeometry: function(geometry, style, featureId) {}, drawGeometry: function(geometry, style, featureId) {},
/** /**
* virtual function * Method: clear
* * Clear all vectors from the renderer.
* Clear all vectors from the renderer * virtual function.
* @private
*/ */
clear: function() {}, clear: function() {},
/** /**
* virtual function * Method: getFeatureIdFromEvent
*
* Returns a feature id from an event on the renderer. * Returns a feature id from an event on the renderer.
* How this happens is specific to the renderer. This should be * How this happens is specific to the renderer. This should be
* called from layer.getFeatureFromEvent(). * called from layer.getFeatureFromEvent().
* Virtual function.
* *
* @param evt {OpenLayers.Event} * Parameters:
* evt - {<OpenLayers.Event>}
* *
* @returns A feature id or null * Returns:
* @type String * {String} A feature id or null.
* @private
*/ */
getFeatureIdFromEvent: function(evt) {}, getFeatureIdFromEvent: function(evt) {},
/** /**
* Method: eraseFeatures
* This is called by the layer to erase features * This is called by the layer to erase features
* @param {Array(OpenLayers.Feature.Vector)} features *
* @private * Parameters:
* features - {Array(<OpenLayers.Feature.Vector>)}
*/ */
eraseFeatures: function(features) { eraseFeatures: function(features) {
if(!(features instanceof Array)) { if(!(features instanceof Array)) {
@@ -174,12 +199,12 @@ OpenLayers.Renderer.prototype =
}, },
/** /**
* virtual function * Method: eraseGeometry
* Remove a geometry from the renderer (by id).
* virtual function.
* *
* Remove a geometry from the renderer (by id) * Parameters:
* * geometry - {<OpenLayers.Geometry>}
* @param geometry {OpenLayers.Geometry}
* @private
*/ */
eraseGeometry: function(geometry) {}, eraseGeometry: function(geometry) {},
+158 -60
View File
@@ -3,8 +3,9 @@
* for the full text of the license. */ * for the full text of the license. */
/** /**
* @class * @requires OpenLayers/Renderer.js
* *
* Class: OpenLayers.Renderer.Elements
* This is another virtual class in that it should never be instantiated by * This is another virtual class in that it should never be instantiated by
* itself as a Renderer. It exists because there is *tons* of shared * itself as a Renderer. It exists because there is *tons* of shared
* functionality between different vector libraries which use nodes/elements * functionality between different vector libraries which use nodes/elements
@@ -15,25 +16,36 @@
* element-based renderer. The details of creating each node and drawing the * element-based renderer. The details of creating each node and drawing the
* paths are of course different, but the machinery is the same. * paths are of course different, but the machinery is the same.
* *
* @requires OpenLayers/Renderer.js * Inherits:
* - <OpenLayers.Renderer>
*/ */
OpenLayers.Renderer.Elements = OpenLayers.Class.create(); OpenLayers.Renderer.Elements = OpenLayers.Class.create();
OpenLayers.Renderer.Elements.prototype = OpenLayers.Renderer.Elements.prototype =
OpenLayers.Class.inherit(OpenLayers.Renderer, { OpenLayers.Class.inherit(OpenLayers.Renderer, {
/** @type DOMElement */ /**
* Property: rendererRoot
* {DOMElement}
*/
rendererRoot: null, rendererRoot: null,
/** @type DOMElement */ /**
* Property: root
* {DOMElement}
*/
root: null, root: null,
/** @type String */ /**
* Property: xmlns
* {String}
*/
xmlns: null, xmlns: null,
/** /**
* @constructor * Constructor: OpenLayers.Renderer.Elements
* *
* @param {String} containerID * Parameters:
* containerID - {String}
*/ */
initialize: function(containerID) { initialize: function(containerID) {
OpenLayers.Renderer.prototype.initialize.apply(this, arguments); OpenLayers.Renderer.prototype.initialize.apply(this, arguments);
@@ -46,7 +58,7 @@ OpenLayers.Renderer.Elements.prototype =
}, },
/** /**
* * Method: destroy
*/ */
destroy: function() { destroy: function() {
@@ -60,8 +72,8 @@ OpenLayers.Renderer.Elements.prototype =
}, },
/** /**
* Method: clear
* Remove all the elements from the root * Remove all the elements from the root
* @private
*/ */
clear: function() { clear: function() {
if (this.root) { if (this.root) {
@@ -71,30 +83,33 @@ OpenLayers.Renderer.Elements.prototype =
} }
}, },
/** This function is in charge of asking the specific renderer which type /**
* of node to create for the given geometry. All geometries in an * Method: getNodeType
* Elements-based renderer consist of one node and some attributes. We * This function is in charge of asking the specific renderer which type
* have the nodeFactory() function which creates a node for us, but it * of node to create for the given geometry. All geometries in an
* takes a 'type' as input, and that is precisely what this function * Elements-based renderer consist of one node and some attributes. We
* tells us. * have the nodeFactory() function which creates a node for us, but it
* takes a 'type' as input, and that is precisely what this function
* tells us.
*
* Parameters:
* geometry - {<OpenLayers.Geometry>}
* *
* @param geometry {OpenLayers.Geometry} * Return:
* * {String} The corresponding node type for the specified geometry
* @returns The corresponding node type for the specified geometry
* @type String
* @private
*/ */
getNodeType: function(geometry) { }, getNodeType: function(geometry) { },
/** /**
* Method: drawGeometry
* Draw the geometry, creating new nodes, setting paths, setting style, * Draw the geometry, creating new nodes, setting paths, setting style,
* setting featureId on the node. This method should only be called * setting featureId on the node. This method should only be called
* by the renderer itself. * by the renderer itself.
* *
* @param {OpenLayers.Geometry} geometry * Parameters:
* @param {Object} style * geometry - {<OpenLayers.Geometry>}
* @param {String} featureId * style - {Object}
* @private * featureId - {String}
*/ */
drawGeometry: function(geometry, style, featureId) { drawGeometry: function(geometry, style, featureId) {
@@ -119,15 +134,16 @@ OpenLayers.Renderer.Elements.prototype =
this.drawGeometryNode(node, geometry); this.drawGeometryNode(node, geometry);
}, },
/** /**
* Method: drawGeometryNode
* Given a node, draw a geometry on the specified layer. * Given a node, draw a geometry on the specified layer.
* node and geometry are required arguments, style is optional. * node and geometry are required arguments, style is optional.
* This method is only called by the render itself. * This method is only called by the render itself.
* *
* @param {DOMElement} node * Parameters:
* @param {OpenLayers.Geometry} geometry * node - {DOMElement}
* @param {Object} style * geometry - {<OpenLayers.Geometry>}
* @private * style - {Object}
*/ */
drawGeometryNode: function(node, geometry, style) { drawGeometryNode: function(node, geometry, style) {
style = style || node._style; style = style || node._style;
@@ -168,43 +184,126 @@ OpenLayers.Renderer.Elements.prototype =
this.setStyle(node, style, options, geometry); this.setStyle(node, style, options, geometry);
}, },
/** /**
* virtual functions for drawing different Geometries. * Method: drawPoint
* These should all be implemented by subclasses. * Virtual function for drawing Point Geometry.
* These methods are only called by the render itself. * Should be implemented by subclasses.
* * This method is only called by the renderer itself.
* @param {DOMElement} node *
* @param {OpenLayers.Geometry} geometry * Parameters:
* @private * node - {DOMElement}
*/ * geometry - {<OpenLayers.Geometry>}
*/
drawPoint: function(node, geometry) {}, drawPoint: function(node, geometry) {},
/**
* Method: drawLineString
* Virtual function for drawing LineString Geometry.
* Should be implemented by subclasses.
* This method is only called by the renderer itself.
*
* Parameters:
* node - {DOMElement}
* geometry - {<OpenLayers.Geometry>}
*/
drawLineString: function(node, geometry) {}, drawLineString: function(node, geometry) {},
/**
* Method: drawLinearRing
* Virtual function for drawing LinearRing Geometry.
* Should be implemented by subclasses.
* This method is only called by the renderer itself.
*
* Parameters:
* node - {DOMElement}
* geometry - {<OpenLayers.Geometry>}
*/
drawLinearRing: function(node, geometry) {}, drawLinearRing: function(node, geometry) {},
/**
* Method: drawPolygon
* Virtual function for drawing Polygon Geometry.
* Should be implemented by subclasses.
* This method is only called by the renderer itself.
*
* Parameters:
* node - {DOMElement}
* geometry - {<OpenLayers.Geometry>}
*/
drawPolygon: function(node, geometry) {}, drawPolygon: function(node, geometry) {},
/**
* Method: drawRectangle
* Virtual function for drawing Rectangle Geometry.
* Should be implemented by subclasses.
* This method is only called by the renderer itself.
*
* Parameters:
* node - {DOMElement}
* geometry - {<OpenLayers.Geometry>}
*/
drawRectangle: function(node, geometry) {}, drawRectangle: function(node, geometry) {},
/**
* Method: drawCircle
* Virtual function for drawing Circle Geometry.
* Should be implemented by subclasses.
* This method is only called by the renderer itself.
*
* Parameters:
* node - {DOMElement}
* geometry - {<OpenLayers.Geometry>}
*/
drawCircle: function(node, geometry) {}, drawCircle: function(node, geometry) {},
/**
* Method: drawCurve
* Virtual function for drawing Curve Geometry.
* Should be implemented by subclasses.
* This method is only called by the renderer itself.
*
* Parameters:
* node - {DOMElement}
* geometry - {<OpenLayers.Geometry>}
*/
drawCurve: function(node, geometry) {}, drawCurve: function(node, geometry) {},
/**
* Method: drawSurface
* Virtual function for drawing Surface Geometry.
* Should be implemented by subclasses.
* This method is only called by the renderer itself.
*
* Parameters:
* node - {DOMElement}
* geometry - {<OpenLayers.Geometry>}
*/
drawSurface: function(node, geometry) {}, drawSurface: function(node, geometry) {},
/** /**
* @param evt {Object} an OpenLayers.Event object * Method: getFeatureIdFromEvent
*
* Parameters:
* evt - {Object} An <OpenLayers.Event> object
* *
* @returns A geometry from an event that happened on a layer * Return:
* @type OpenLayers.Geometry * {<OpenLayers.Geometry>} A geometry from an event that
* @private * happened on a layer
*/ */
getFeatureIdFromEvent: function(evt) { getFeatureIdFromEvent: function(evt) {
var node = evt.target || evt.srcElement; var node = evt.target || evt.srcElement;
return node._featureId; return node._featureId;
}, },
/** Erase a geometry from the renderer. In the case of a multi-geometry, /**
* we cycle through and recurse on ourselves. Otherwise, we look for a * Method: eraseGeometry
* node with the geometry.id, destroy its geometry, and remove it from * Erase a geometry from the renderer. In the case of a multi-geometry,
* the DOM. * we cycle through and recurse on ourselves. Otherwise, we look for a
* node with the geometry.id, destroy its geometry, and remove it from
* the DOM.
* *
* @param {OpenLayers.Geometry} geometry * Parameters:
* @private * geometry - {<OpenLayers.Geometry>}
*/ */
eraseGeometry: function(geometry) { eraseGeometry: function(geometry) {
if ((geometry.CLASS_NAME == "OpenLayers.Geometry.MultiPoint") || if ((geometry.CLASS_NAME == "OpenLayers.Geometry.MultiPoint") ||
@@ -226,20 +325,19 @@ OpenLayers.Renderer.Elements.prototype =
}, },
/** /**
* @private * Method: nodeFactory
*
* Create new node of the specified type, with the (optional) specified id. * Create new node of the specified type, with the (optional) specified id.
* *
* If node already exists with same ID and type, we remove it and then * If node already exists with same ID and type, we remove it and then
* call ourselves again to recreate it. * call ourselves again to recreate it.
* *
* @param {String} id * Parameters:
* @param {String} type Kind of node to draw * id - {String}
* @param {OpenLayers.Geometry} geometry * type - {String} type Kind of node to draw
* geometry - {<OpenLayers.Geometry>}
* *
* @returns A new node of the given type and id * Return:
* @type DOMElement * {DOMElement} A new node of the given type and id
* @private
*/ */
nodeFactory: function(id, type, geometry) { nodeFactory: function(id, type, geometry) {
var node = $(id); var node = $(id);

Some files were not shown because too many files have changed in this diff Show More