本文整理汇总了Java中com.google.gwt.maps.client.geom.LatLng类的典型用法代码示例。如果您正苦于以下问题:Java LatLng类的具体用法?Java LatLng怎么用?Java LatLng使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LatLng类属于com.google.gwt.maps.client.geom包,在下文中一共展示了LatLng类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createNativePin
import com.google.gwt.maps.client.geom.LatLng; //导入依赖的package包/类
@Override
protected Marker createNativePin(Pin pin) {
final MarkerOptions options = MarkerOptions.newInstance();
if(pin.getTitle() != null) {
options.setTitle(pin.getTitle());
}
options.setDraggable(pin.isDraggable());
if(pin.getImageURL() != null) {
final Icon icon = Icon.newInstance(pin.getImageURL());
icon.setIconSize(Size.newInstance(pin.getImageWidth(), pin.getImageHeight()));
icon.setIconAnchor(Point.newInstance(
// Horizontal center
pin.getImageWidth() / 2,
// Bottom
pin.getImageHeight()));
options.setIcon(icon);
}
return new Marker(
LatLng.newInstance(pin.getLatitude(), pin.getLongitude()),
options);
}
示例2: showPointSelection
import com.google.gwt.maps.client.geom.LatLng; //导入依赖的package包/类
public void showPointSelection(LatLng pt)
{
MarkerOptions mo = MarkerOptions.newInstance(_pointSelectionIcon);
final Marker m = new Marker(pt,mo);
mo.setClickable(true);
mo.setDraggable(false);
_map.addOverlay(m);
Timer t = new Timer(){
public void run() {
_map.removeOverlay(m);
}
};
t.schedule(4000);
}
示例3: getLatLngFromUrl
import com.google.gwt.maps.client.geom.LatLng; //导入依赖的package包/类
protected LatLng getLatLngFromUrl()
{
String lat = Window.Location.getParameter("lat");
String lng = Window.Location.getParameter("lng");
if ((lat == null) || (lng == null))
{
return null;
}
try {
double latd = Double.parseDouble(lat);
double lngd = Double.parseDouble(lng);
return LatLng.newInstance(latd, lngd);
} catch (NumberFormatException e) {
return null;
}
}
示例4: onClick
import com.google.gwt.maps.client.geom.LatLng; //导入依赖的package包/类
public void onClick(MapClickEvent e)
{
MapWidget sender = e.getSender();
Overlay overlay = e.getOverlay();
LatLng point = e.getLatLng();
sender.clearOverlays();
MarkerOptions options = MarkerOptions.newInstance();
options.setDraggable(false);
Marker m = new Marker(point,options);
sender.addOverlay(m);
_mapManager.setPickedLocation(point);
/*if (overlay != null && overlay instanceof Marker)
{
sender.removeOverlay(overlay);
} else {
sender.addOverlay(new Marker(point));
}*/
}
示例5: getBikeStackFromUserInterface
import com.google.gwt.maps.client.geom.LatLng; //导入依赖的package包/类
/**
* gets a new bikestack object from the user interface
* @return
*/
protected BikeStack getBikeStackFromUserInterface()
{
BikeStack bs = new BikeStack();
bs.setUser(_uiStateManager.getUserName());
LatLng pickedPoint = _mapManager.getPickedLocation();
bs.setLocation(pickedPoint.getLatitude(), pickedPoint.getLongitude());
bs.setOccuredDate(getDatePickerOccured().getSelectedDate());
int selIndex = getListBoxStackTypes().getSelectedIndex();
int type = _bingleTypeManager.getIdFromIndex(selIndex);
bs.setType(type);
bs.setDescription(getStackDescription());
bs.setEntryDate(new Date());
bs.setLink(getLink());
bs.setInjurySeverity((int)getSliderBarInjurySeverity().getCurrentValue());
return bs;
}
示例6: getBingleAsJsonObject
import com.google.gwt.maps.client.geom.LatLng; //导入依赖的package包/类
protected JSONObject getBingleAsJsonObject(BikeStack bingle)
{
JSONObject jObj = new JSONObject();
jObj.put(JSON_NAME_DESCRIPTION, getJsonString(bingle.getDescription()));
//JSONObject user = new JSONObject();
//user.put(JSON_NAME_ENTERED_BY_NAME, new JSONString(bingle.getUser()));
//user.put(JSON_NAME_ENTERED_BY_EMAIL, new JSONString(bingle.getEmail()));
//jObj.put(JSON_NAME_ENTERED_BY, user);
jObj.put(JSON_NAME_OCCURED_ON, getJsonDate(bingle.getOccuredDate()));
jObj.put(JSON_NAME_INJURY_INDEX, new JSONNumber(bingle.getInjurySeverity()));
LatLng pt = bingle.getPosition();
JSONObject pos = new JSONObject();
pos.put(JSON_NAME_POSITION_LATITUDE, new JSONNumber(pt.getLatitude()));
pos.put(JSON_NAME_POSITION_LONGITUDE, new JSONNumber(pt.getLongitude()));
jObj.put(JSON_NAME_POSITION, pos);
jObj.put(JSON_NAME_TYPE, new JSONNumber(bingle.getType()));
jObj.put(JSON_NAME_LINK, getJsonString(bingle.getLink()));
return jObj;
}
示例7: drawOnMap
import com.google.gwt.maps.client.geom.LatLng; //导入依赖的package包/类
/**
* draws the representation of this quad tree onto the given map using
* overlays.
* @param map
*/
public void drawOnMap(MapWidget map)
{
Iterator leaves = _leafNodes.iterator();
while (leaves.hasNext())
{
QuadTreeNode leafNode = (QuadTreeNode)leaves.next();
LatLng[] pts = getBoundsAsPoints(leafNode.getBounds());
//GWT.log(leafNode.getBounds().toString(), null);
String colour = ColourMap.getColour(leafNode.getStacks().size(), _maxEntriesInAnyNode);
Polygon poly = new Polygon(pts,"#ff0000",0,0.7,colour,0.4);
//Polyline poly = new Polyline(pts,"#ff0000",3,0.7);
//PolyStyleOptions pso = PolyStyleOptions.newInstance("#ff0000",3, 0.7);
//poly.setStrokeStyle(pso);
map.addOverlay(poly);
}
}
示例8: getBoundsQuadded
import com.google.gwt.maps.client.geom.LatLng; //导入依赖的package包/类
/**
* divides the given bounds into quadrants. The returned array
* comes back in the following order NE, SE, SW, NW.
* @param bounds an array of four bounds
* @return
*/
public LatLngBounds[] getBoundsQuadded(LatLngBounds bounds)
{
LatLng ne = bounds.getNorthEast();
LatLng sw = bounds.getSouthWest();
LatLng center = bounds.getCenter();
LatLng n = LatLng.newInstance(center.getLatitude(), ne.getLongitude());
LatLng e = LatLng.newInstance(ne.getLatitude(), center.getLongitude());
LatLng s = LatLng.newInstance(center.getLatitude(), sw.getLongitude());
LatLng w = LatLng.newInstance(sw.getLatitude(), center.getLongitude());
LatLngBounds boundsNe = LatLngBounds.newInstance(center, ne);
LatLngBounds boundsSe = LatLngBounds.newInstance(s, e);
LatLngBounds boundsSw = LatLngBounds.newInstance(sw, center);
LatLngBounds boundsNw = LatLngBounds.newInstance(w, n);
LatLngBounds[] res = {boundsNe,boundsSe,boundsSw,boundsNw};
return res;
}
示例9: handleCityValueChange
import com.google.gwt.maps.client.geom.LatLng; //导入依赖的package包/类
private void handleCityValueChange() {
try {
if (!city.getValue().isEmpty()) {
if (!state.getValue().isEmpty()) {
String srch = city.getValue().trim() + ", " + state.getValue().trim();
LatLng point = ResultsHelper.LOC_TO_LATLNG.get(srch);
if (point != null) {
map.clearOverlays();
map.setCenter(point);
setMarker(point);
}
}
}
} catch (Exception e) {
}
}
示例10: getMapBoundsSearchCriteria
import com.google.gwt.maps.client.geom.LatLng; //导入依赖的package包/类
public List<SearchCriteriaIFace> getMapBoundsSearchCriteria() {
List<SearchCriteriaIFace> cList = new ArrayList<SearchCriteriaIFace>();
LatLngBounds bounds = map.getBounds();
LatLng neBound = bounds.getNorthEast();
LatLng swBound = bounds.getSouthWest();
double minLat = swBound.getLatitude();
double maxLat = neBound.getLatitude();
double minLng = swBound.getLongitude();
double maxLng = neBound.getLongitude();
cList.add(PropertyOptions.getLatRangeSearchCriteria(minLat, maxLat));
cList.add(PropertyOptions.getLngRangeSearchCriteria(minLng, maxLng));
return cList;
}
示例11: displayResults
import com.google.gwt.maps.client.geom.LatLng; //导入依赖的package包/类
private void displayResults(List<Neightbourhood> neighbourhoodList) {
for (Neightbourhood n : neighbourhoodList) {
Marker m = new Marker(LatLng.newInstance(n.getLat().doubleValue(), n.getLng().doubleValue()),
categoryToMarkerOptions.get(n.getCategory()));
// m.setImage(categoryToIconsMap.get(n.getCategory()));
// m.setImage("images/benzin_istasyonu.png");
List<Marker> overlayList = null;// categoryToMarkers.get(n.getCategory
// ());
if (!categoryToMarkers.containsKey(n.getCategory())) {
overlayList = new ArrayList<Marker>();
categoryToMarkers.put(n.getCategory(), overlayList);
} else {
overlayList = categoryToMarkers.get(n.getCategory());
}
overlayList.add(m);
map.addOverlay(m);
}
}
示例12: requestPosition
import com.google.gwt.maps.client.geom.LatLng; //导入依赖的package包/类
private void requestPosition()
{
geo.getCurrentPosition(new PositionCallback() {
public void onFailure(PositionError error)
{
String message = "";
switch (error.getCode()) {
case PositionError.UNKNOWN_ERROR:
message = "Unknown Error";
break;
case PositionError.PERMISSION_DENIED:
message = "Permission Denied";
break;
case PositionError.POSITION_UNAVAILABLE:
message = "Position Unavailable";
break;
case PositionError.TIMEOUT:
message = "Time-out";
break;
default:
message = "Unknown error code.";
}
RootPanel.get("error").add(
new Label("Message: '" + error.getMessage() + "', code: " + error.getCode() + " (" + message + ")"));
}
public void onSuccess(Position position)
{
Coordinates c = position.getCoords();
final LatLng point = LatLng.newInstance(c.getLatitude(), c.getLongitude());
final String url = URL_STATIC + "?pos=" + point.toUrlValue();
addLinks(url, "");
}
}, PositionOptions.getPositionOptions(true /* GPS if possible */, 60000 /* timeout 1min */, 0 /* new position */));
}
示例13: addPinDragEndHandler
import com.google.gwt.maps.client.geom.LatLng; //导入依赖的package包/类
@Override
protected void addPinDragEndHandler(Marker pin, final PinDragEndHandler dragEndHandler) {
pin.addMarkerDragEndHandler(new MarkerDragEndHandler() {
@Override
public void onDragEnd(MarkerDragEndHandler.MarkerDragEndEvent event) {
final LatLng latLng = event.getSender().getLatLng();
dragEndHandler.onDragEnd(latLng.getLatitude(), latLng.getLongitude());
}
});
}
示例14: setPickedLocation
import com.google.gwt.maps.client.geom.LatLng; //导入依赖的package包/类
/**
* sets the location the user has picked on the map, also fires an event
* off to any added StackLocationPickedListeners.
* @param pickedLocation
*/
void setPickedLocation(LatLng pickedLocation)
{
_pickedPoint = pickedLocation;
if (_pickedPoint == null)
_map.clearOverlays();
fireStackLocationPickedEvent(pickedLocation);
}
示例15: fireStackLocationPickedEvent
import com.google.gwt.maps.client.geom.LatLng; //导入依赖的package包/类
protected void fireStackLocationPickedEvent(LatLng point)
{
for(Iterator it = _eventListenersStackLocation.iterator(); it.hasNext();)
{
StackLocationPickedListener listener = (StackLocationPickedListener) it.next();
listener.onStackLocationPicked(point);
}
}