本文整理汇总了Java中org.gwtopenmaps.openlayers.client.util.JSObject类的典型用法代码示例。如果您正苦于以下问题:Java JSObject类的具体用法?Java JSObject怎么用?Java JSObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JSObject类属于org.gwtopenmaps.openlayers.client.util包,在下文中一共展示了JSObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMyUrl
import org.gwtopenmaps.openlayers.client.util.JSObject; //导入依赖的package包/类
private static native JSObject getMyUrl() /*-{
function get_my_url(bounds) {
var res = this.map.getResolution();
var x = Math.round((bounds.left - this.maxExtent.left)
/ (res * this.tileSize.w));
var y = Math.round((this.maxExtent.top - bounds.top)
/ (res * this.tileSize.h));
var z = this.map.getZoom();
var limit = Math.pow(2, z);
if (y < 0 || y >= limit) {
return null;
} else {
x = ((x % limit) + limit) % limit;
url = this.url;
path = z + "/" + x + "/" + y + "." + this.type;
if (url instanceof Array) {
url = this.selectUrl(path, url);
}
return url + path;
}
}
return get_my_url;
}-*/;
示例2: getColorStyleData
import org.gwtopenmaps.openlayers.client.util.JSObject; //导入依赖的package包/类
private void getColorStyleData(Style style) {
if(style != null) {
JSObject jsStyle = style.getJSObject();
String fillColor = jsStyle.getPropertyAsString("userFillColor");
String strokeColor = jsStyle.getPropertyAsString("userStrokeColor");
int thickness = (int) Math.floor(style.getStrokeWidth());
/**
* Si estamos en modo de estilo por feature, hay que coger el color
* de referencia de las propiedades userFillColor y userStrokeColor,
* puesto que los features afectados están seleccionados y por tanto
* tienen asignado el color de relleno y linea del modo selección
*/
getFill().setNormalColor(fillColor != null ? fillColor : style.getFillColor());
getFill().setOpacity(style.getFillOpacity());
getLine().setNormalColor(strokeColor != null ? strokeColor : style.getStrokeColor());
getLine().setThickness(thickness);
}
}
示例3: getLabelStyleData
import org.gwtopenmaps.openlayers.client.util.JSObject; //导入依赖的package包/类
private void getLabelStyleData(Style style, VectorLayer layer) {
if(style != null) {
JSObject jsStyle = style.getJSObject();
boolean enabled = jsStyle.getPropertyAsString("userAttributeLabel") != null
&& !jsStyle.getPropertyAsString("userAttributeLabel").isEmpty();
if(enabled) {
getLabel().setAttribute(layer.getAttribute(
jsStyle.getPropertyAsString("userAttributeLabel")));
getLabel().setFontSize(getFontSize(jsStyle));
getLabel().setBoldStyle(isBoldFont(jsStyle));
getLabel().setBackgroundColor(jsStyle.getPropertyAsString("labelOutlineColor"));
}
}
}
示例4: applyColorStyle
import org.gwtopenmaps.openlayers.client.util.JSObject; //导入依赖的package包/类
private void applyColorStyle(Style style) {
style.setFillColor(getFill().getNormalColor());
style.setFillOpacity(getFill().getOpacity());
style.setStrokeColor(getLine().getNormalColor());
style.setStrokeWidth(getLine().getThickness());
/**
* Se almacena el mismo color de relleno y linea en las propiedades
* userFillColor y userStrokeColor para tenerlo siempre disponible
* y asi poder aplicar los efectos de select y hover mediante eventos
* (ver VectorLayer.addFeatureSelectListeners())
*/
JSObject jsStyle = style.getJSObject();
jsStyle.setProperty("userFillColor", getFill().getNormalColor());
jsStyle.setProperty("userStrokeColor", getLine().getNormalColor());
}
示例5: read
import org.gwtopenmaps.openlayers.client.util.JSObject; //导入依赖的package包/类
public VectorFeature[] read(String vectorFormatString) {
JSObject out = FormatImpl.read(getJSObject(), vectorFormatString);
JObjectArray jObjectArray = JObjectArray.narrowToJObjectArray(out.ensureOpaqueArray());
int nr = jObjectArray.length();
VectorFeature[] vfs = new VectorFeature[nr];
for (int i = 0; i < nr; i++) {
VectorFeature vf = VectorFeature.narrowToVectorFeature(jObjectArray.get(i));
JSObject styleObject = jObjectArray.get(i).getProperty(STYLE_NAME);
if (styleObject != null) {
VectorFeatureStyleDef def = getStyleDef(styleObject);
vf.setStyle(def.toStyle(vf));
}
vfs[i] = vf;
}
return vfs;
}
示例6: getStyle
import org.gwtopenmaps.openlayers.client.util.JSObject; //导入依赖的package包/类
public static JSObject getStyle(VectorStyleDef def) {
String fillColor = def.getFill().getNormalColor();
Double fillOpacity = def.getFill().getOpacity();
String strokeColor = def.getLine().getNormalColor();
Double strokeWidth = new Double(def.getLine().getThickness());
JSObject styleObject = JSObject.createJSObject();
styleObject.setProperty(FILL_NAME, true);
styleObject.setProperty(FILL_COLOR_NAME, fillColor);
styleObject.setProperty(FILL_OPACITY_NAME, fillOpacity);
styleObject.setProperty(STROKE_COLOR_NAME, strokeColor);
styleObject.setProperty(STROKE_WIDTH_NAME, strokeWidth);
styleObject.setProperty(RADIUS_NAME, RADIUS_VALUE);
//icon
String iconUrl = def.getPoint().getExternalGraphic();
if (iconUrl != null) {
JSObject iconObject = JSObject.createJSObject();
iconObject.setProperty(ICON_URL_NAME, iconUrl);
JsArrayInteger iconSize = JSObject.createArray().cast();
iconSize.push(def.getPoint().getGraphicWidth());
iconSize.push(def.getPoint().getGraphicHeight());
JSObject iconSizeObject = iconSize.cast();
iconObject.setProperty(ICON_SIZE_NAME, iconSizeObject);
styleObject.setProperty(ICON_NAME, iconObject);
}
return styleObject;
}
示例7: getFontSize
import org.gwtopenmaps.openlayers.client.util.JSObject; //导入依赖的package包/类
private Integer getFontSize(JSObject style) {
String fontSize = style.getPropertyAsString("fontSize");
if(fontSize != null && !fontSize.isEmpty()) {
fontSize = fontSize.substring(0, fontSize.lastIndexOf("px"));
return Integer.parseInt(fontSize);
}
return LabelStyle.DEFAULT_FONT_SIZE;
}
示例8: isBoldFont
import org.gwtopenmaps.openlayers.client.util.JSObject; //导入依赖的package包/类
private boolean isBoldFont(JSObject style) {
String fontWeight = style.getPropertyAsString("fontWeight");
if(fontWeight == null || fontWeight.isEmpty()) {
fontWeight = "regular";
}
return fontWeight.equalsIgnoreCase("bold");
}
示例9: applyLabelStyle
import org.gwtopenmaps.openlayers.client.util.JSObject; //导入依赖的package包/类
private void applyLabelStyle(Style style, VectorFeature feature) {
JSObject jsStyle = style.getJSObject();
if(getLabel().isEnabled()) {
style.setLabel(feature.getAttributes().getAttributeAsString(
getLabel().getAttribute().getName()));
style.setFontSize(getLabel().getFontSize() + "px");
/**
* Se almacena el atributo de etiquetado en la propiedad
* userAttributeLabel para tenerlo disponible a la hora de
* recargar el dialogo de estilos
*/
jsStyle.setProperty("userAttributeLabel",
getLabel().getAttribute().getName());
style.setFontWeight(getLabel().isBoldStyle() ? "bold" : "regular");
final boolean labelBackgroung = !getLabel()
.getBackgroundColor().isEmpty();
jsStyle.setProperty("labelOutlineWidth", (labelBackgroung ? 10 : 0));
jsStyle.setProperty("labelOutlineColor", (labelBackgroung ?
getLabel().getBackgroundColor() : ""));
} else {
style.setLabel(null);
jsStyle.unsetProperty("userAttributeLabel");
}
}
示例10: toStyleMap
import org.gwtopenmaps.openlayers.client.util.JSObject; //导入依赖的package包/类
public StyleMap toStyleMap() {
String labelAttribute = getLabel().isEnabled() ? getLabel().getAttribute().getName() : null;
String colorThemingAttribute = isColorThemingEnabled() ? getColorThemingAttribute().getName() : null;
Style normalStyle = StyleFactory.createStyle(
getLine().getNormalColor(), getLine().getThickness(),
getFill().getNormalColor(), getFill().getOpacity(),
labelAttribute, colorThemingAttribute);
Style selectedStyle = StyleFactory.createStyle(
getLine().getSelectedColor(), getLine().getThickness(),
getFill().getSelectedColor(), getFill().getOpacity(),
labelAttribute, null);
Style hoverStyle = StyleFactory.createStyle(
getLine().getHoverColor(), getLine().getThickness(),
getFill().getHoverColor(), getFill().getOpacity(),
labelAttribute, null);
JSObject jsStyle = normalStyle.getJSObject().getProperty("defaultStyle");
if (getLabel().isEnabled()) {
jsStyle.setProperty("fontSize", getLabel().getFontSize() + "px");
jsStyle.setProperty("fontWeight", getLabel().isBoldStyle() ? "bold" : "regular");
final boolean labelBackgroung = getLabel().getBackgroundColor() != null;
jsStyle.setProperty("labelOutlineWidth", (labelBackgroung ? 10 : 0));
jsStyle.setProperty("labelOutlineColor", labelBackgroung ?
getLabel().getBackgroundColor() : "");
}
jsStyle.setProperty("graphicName", getPoint().getVertexStyle().getStyleName());
jsStyle.setProperty("externalGraphic", getPoint().getExternalGraphic());
jsStyle.setProperty("graphicWidth", getPoint().getGraphicWidth());
jsStyle.setProperty("graphicHeight", getPoint().getGraphicHeight());
return new StyleMap(normalStyle, selectedStyle, hoverStyle);
}
示例11: getLayerStyle
import org.gwtopenmaps.openlayers.client.util.JSObject; //导入依赖的package包/类
public VectorStyleDef getLayerStyle(String vectorFormatString) {
VectorFeatureStyleDef def = null;
final JSONValue jsonValue = JSONParser.parseLenient(vectorFormatString);
final JSONObject geoJSONCssObject = jsonValue.isObject();
if (geoJSONCssObject.containsKey(GeoJSONCSS.STYLE_NAME)) {
JSONObject styleObject = geoJSONCssObject.get(GeoJSONCSS.STYLE_NAME).isObject();
JSObject styleJSObject = styleObject.getJavaScriptObject().cast();
def = getStyleDef(styleJSObject);
}
return def;
}
示例12: VectorLayer
import org.gwtopenmaps.openlayers.client.util.JSObject; //导入依赖的package包/类
public VectorLayer(JSObject vector) {
super(vector);
this.featureSchema = new FeatureSchema();
setVectorStyle(new VectorStyleDef());
addFeatureAddedListener();
addFeatureSelectListeners();
}
示例13: createFeatureAddedCallback
import org.gwtopenmaps.openlayers.client.util.JSObject; //导入依赖的package包/类
public static native JSObject createFeatureAddedCallback(FeatureAddedListener listener)/*-{
var callback = function(obj){
var vectorFeatureObj = @org.gwtopenmaps.openlayers.client.feature.VectorFeature::narrowToVectorFeature(Lorg/gwtopenmaps/openlayers/client/util/JSObject;)(obj);
[email protected]ture.FeatureAddedListener::onFeatureAdded(Lorg/gwtopenmaps/openlayers/client/feature/VectorFeature;)(vectorFeatureObj);
}
return callback;
}-*/;
示例14: getDefaultMapOptions
import org.gwtopenmaps.openlayers.client.util.JSObject; //导入依赖的package包/类
protected static MapOptions getDefaultMapOptions() {
MapOptions mapOptions = new MapOptions();
mapOptions.setProjection("CRS:84");
mapOptions.setDisplayProjection(CRS84);
mapOptions.removeDefaultControls();
mapOptions.setControls(new JObjectArray(new JSObject[0]));
JSObject vendorParams = JSObject.createJSObject();
vendorParams.setProperty("theme", GWT.getModuleBaseURL() + "theme/default/style.css");
mapOptions.setJSObject(vendorParams);
return mapOptions;
}
示例15: create
import org.gwtopenmaps.openlayers.client.util.JSObject; //导入依赖的package包/类
/**
* Creates the.
*
* @return the jS object
*/
public static native JSObject create()/*-{
var control = new $wnd.OpenLayers.Control.ZoomIn();
$wnd.OpenLayers.Util.extend(control, {
draw: function () {
this.box = new $wnd.OpenLayers.Handler.Box( control,
{"done": this.notice},
{keyMask: $wnd.OpenLayers.Handler.MOD_SHIFT});
this.box.activate();
}
});
return control;
}-*/;