List of usage examples for android.graphics Color BLACK
int BLACK
To view the source code for android.graphics Color BLACK.
Click Source Link
From source file:com.skytree.epubtest.BookViewActivity.java
public void fillBookmarkList() { this.listView.removeAllViews(); ArrayList<PageInformation> pis = sd.fetchBookmarks(this.bookCode); for (int i = 0; i < pis.size(); i++) { int textColor = Color.BLACK; Theme theme = getCurrentTheme(); textColor = theme.foregroundColor; PageInformation pi = pis.get(i); SkyLayout item = new SkyLayout(this); setFrame(item, 0, 0, listBox.getWidth(), ps(80)); ImageButton mark = this.makeImageButton(9898, R.drawable.bookmarked2x, ps(50), ps(90)); item.addView(mark);/* w w w .ja va2 s. c o m*/ setFrame(mark, ps(10), ps(5), ps(60), ps(120)); int ci = pi.chapterIndex; if (rv.isRTL()) { ci = rv.getNumberOfChapters() - ci - 1; } String chapterTitle = rv.getChapterTitle(ci); if (chapterTitle == null || chapterTitle.isEmpty()) chapterTitle = "Chapter " + ci; TextView chapterLabel = this.makeLabel(9899, chapterTitle, Gravity.LEFT, 16, textColor); setFrame(chapterLabel, ps(80), ps(5), this.listBox.getWidth() - ps(80), ps(40)); item.addView(chapterLabel); TextView dateLabel = this.makeLabel(9899, pi.datetime, Gravity.LEFT, 12, textColor); setFrame(dateLabel, this.listBox.getWidth() - ps(50 + 250), ps(48), this.listBox.getWidth() - ps(40), ps(40)); View lineView = new View(this); lineView.setBackgroundColor(Color.LTGRAY); setFrame(lineView, 0, ps(79), this.listBox.getWidth(), ps(1)); item.addView(dateLabel); item.addView(lineView); item.setSkyLayoutListener(bookmarkListDelegate); item.setId(pi.code); item.data = pi; Button deleteButton = new Button(this); GradientDrawable grad = new GradientDrawable(Orientation.TOP_BOTTOM, new int[] { 0xffcf666e, 0xff671521 }); grad.setStroke(ps(2), 0xff282828); deleteButton.setBackgroundDrawable(grad); deleteButton.setText(getString(R.string.delete)); deleteButton.setTextSize(12); deleteButton.setTypeface(null, Typeface.BOLD); deleteButton.setTextColor(Color.WHITE); deleteButton.setId(pi.code); deleteButton.setVisibility(View.INVISIBLE); deleteButton.setVisibility(View.GONE); deleteButton.setOnClickListener(deleteBookmarkDelegate); int dw = ps(120); int dh = ps(50); setFrame(deleteButton, this.listView.getWidth() - dw, (ps(80) - dh) / 2, dw, dh); item.deleteControl = deleteButton; item.addView(deleteButton); this.listView.addView(item); } }
From source file:cl.gisred.android.LectorInspActivity.java
private void singleTapOnMap() { myMapView.setOnSingleTapListener(new OnSingleTapListener() { @Override/*from w ww.ja v a 2 s . c om*/ public void onSingleTap(float x, float y) { if (bMapTap) { Point oPoint = myMapView.toMapPoint(x, y); if (mBusquedaLayer != null && myMapView.getLayerByID(mBusquedaLayer.getID()) != null) myMapView.removeLayer(mBusquedaLayer); if (mSeleccionLayer != null && myMapView.getLayerByID(mSeleccionLayer.getID()) != null) myMapView.removeLayer(mSeleccionLayer); if (bCallOut) { if (nIndentify > 0) { mSeleccionLayer = new GraphicsLayer(); SimpleMarkerSymbol resultSymbol = new SimpleMarkerSymbol(Color.GREEN, 12, SimpleMarkerSymbol.STYLE.CIRCLE); Graphic resultLocGraphic = new Graphic(oPoint, resultSymbol); mSeleccionLayer.addGraphic(resultLocGraphic); myMapView.addLayer(mSeleccionLayer); //TODO buscar tramo switch (nIndentify) { case 1: getCalleToDialog(oPoint); break; case 2: getTramoToDialog(oPoint); break; } } else { mSeleccionLayer = new GraphicsLayer(); int[] selectedFeatures = oLySelectAsoc.getGraphicIDs(x, y, calcRadio(), 1000); // select the features oLySelectAsoc.clearSelection(); oLySelectAsoc.setSelectedGraphics(selectedFeatures, true); if (selectedFeatures.length > 0) { Graphic[] results = oLySelectAsoc.getSelectedFeatures(); Callout mapCallout = myMapView.getCallout(); mapCallout.hide(); for (Graphic graphic : results) { Map<String, Object> attr = graphic.getAttributes(); Util oUtil = new Util(); CalloutTvClass oCall = oUtil.getCalloutValues(attr); GisTextView tv = new GisTextView(LectorInspActivity.this); tv.setText(oCall.getVista()); tv.setHint(oCall.getValor()); tv.setIdObjeto(oCall.getIdObjeto()); tv.setPoint((Point) graphic.getGeometry()); tv.setTipo("nueva"); tv.setTextColor(Color.WHITE); tv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { oTxtAsoc.setIdObjeto(((GisTextView) v).getIdObjeto()); oTxtAsoc.setText(((GisTextView) v).getHint()); oTxtAsoc.setTipo(((GisTextView) v).getTipo()); oTxtAsoc.setPoint(myMapView.getCallout().getCoordinates()); bCallOut = false; bMapTap = false; myMapView.getCallout().hide(); oLySelectAsoc.clearSelection(); dialogCur.show(); if (mSeleccionLayer != null && myMapView.getLayerByID(mSeleccionLayer.getID()) != null) myMapView.removeLayer(mSeleccionLayer); // LINE PRINT if (mUbicacionLayer != null && oUbicacion != null) { SimpleLineSymbol lineSymbol = new SimpleLineSymbol(Color.BLUE, 4, SimpleLineSymbol.STYLE.DASH); Polyline oLine = new Polyline(); oLine.startPath(oUbicacion); oLine.lineTo(oTxtAsoc.getPoint()); Graphic graphicDireccion = new Graphic(oLine, lineSymbol, null); mUbicacionLayer.addGraphic(graphicDireccion); } } }); Point point = (Point) graphic.getGeometry(); mapCallout.setOffset(0, -3); mapCallout.setCoordinates(point); mapCallout.setMaxHeight(100); mapCallout.setMaxWidth(400); mapCallout.setStyle(R.xml.mycalloutprefs); mapCallout.setContent(tv); mapCallout.show(); } } else { getAsocObject(oPoint); } SimpleMarkerSymbol resultSymbol = new SimpleMarkerSymbol(Color.GREEN, 12, SimpleMarkerSymbol.STYLE.CIRCLE); Graphic resultLocGraphic = new Graphic(oPoint, resultSymbol); mSeleccionLayer.addGraphic(resultLocGraphic); myMapView.addLayer(mSeleccionLayer); } } else { if (mUbicacionLayer != null && myMapView.getLayerByID(mUbicacionLayer.getID()) != null) myMapView.removeLayer(mUbicacionLayer); oUbicacion = oPoint; mUbicacionLayer = new GraphicsLayer(); SimpleMarkerSymbol resultSymbol = new SimpleMarkerSymbol(Color.RED, 12, SimpleMarkerSymbol.STYLE.DIAMOND); Graphic resultLocGraphic = new Graphic(oPoint, resultSymbol); mUbicacionLayer.addGraphic(resultLocGraphic); myMapView.addLayer(mUbicacionLayer); if (R.layout.dialog_poste == idResLayoutSelect) { LyPOSTES.setVisible(true); if (LyPOSTES.getMinScale() < myMapView.getScale()) myMapView.zoomToScale(oPoint, LyPOSTES.getMinScale() * 0.9); } else if (R.layout.dialog_direccion == idResLayoutSelect) { LyDIRECCIONES.setVisible(true); if (LyDIRECCIONES.getMinScale() < myMapView.getScale()) myMapView.zoomToScale(oPoint, LyDIRECCIONES.getMinScale() * 0.9); } else if (R.layout.dialog_cliente == idResLayoutSelect || R.layout.dialog_cliente_cnr == idResLayoutSelect) { LyPOSTES.setVisible(true); LyDIRECCIONES.setVisible(true); LyCLIENTES.setVisible(true); if (idResLayoutSelect == R.layout.dialog_cliente_cnr) LyREDBT.setVisible(true); if (LyPOSTES.getMinScale() < myMapView.getScale()) myMapView.zoomToScale(oPoint, LyPOSTES.getMinScale() * 0.9); } else if (R.layout.form_lectores == idResLayoutSelect) { if (LyPOSTES.getMinScale() < myMapView.getScale()) myMapView.zoomToScale(oPoint, LyPOSTES.getMinScale() * 0.9); } } } else { if (bVerData) { double nExtendScale = myMapView.getScale(); double layerScala = 0; ArrayList<ArcGISDynamicMapServiceLayer> arrayLay = new ArrayList<>(); Point oPoint = myMapView.toMapPoint(x, y); if (oLyViewGraphs != null && myMapView.getLayerByID(oLyViewGraphs.getID()) != null) myMapView.removeLayer(oLyViewGraphs); oLyViewGraphs = new GraphicsLayer(); SimpleMarkerSymbol oMarketSymbol = new SimpleMarkerSymbol(Color.BLACK, 10, SimpleMarkerSymbol.STYLE.CIRCLE); oMarketSymbol.setOutline(new SimpleLineSymbol(Color.RED, 1, SimpleLineSymbol.STYLE.SOLID)); Graphic oGraph = new Graphic(oPoint, oMarketSymbol); oLyViewGraphs.addGraphic(oGraph); myMapView.addLayer(oLyViewGraphs); for (Layer oLayer : myMapView.getLayers()) { if ((oLayer.getName() != null && !oLayer.getName().equalsIgnoreCase("MapaBase")) && oLayer.isVisible()) { if (oLayer.getClass().equals(ArcGISDynamicMapServiceLayer.class)) { for (ArcGISLayerInfo arcGISLayerInfo : ((ArcGISDynamicMapServiceLayer) oLayer) .getLayers()) { if (arcGISLayerInfo.isVisible()) { layerScala = (arcGISLayerInfo.getMinScale() > 0) ? arcGISLayerInfo.getMinScale() : 0; break; } } layerScala = (layerScala > 0) ? layerScala : nExtendScale; if (nExtendScale <= layerScala) { arrayLay.add((ArcGISDynamicMapServiceLayer) oLayer); } } } } if (arrayLay.size() > 0) { ArcGISDynamicMapServiceLayer[] aLay = new ArcGISDynamicMapServiceLayer[arrayLay.size()]; aLay = arrayLay.toArray(aLay); getInfoObject(oPoint, aLay); } else { Toast.makeText(getApplicationContext(), "No hay capas visibles", Toast.LENGTH_SHORT) .show(); } } } } }); }
From source file:cl.gisred.android.MapsActivity.java
private void singleTapOnMap() { myMapView.setOnSingleTapListener(new OnSingleTapListener() { @Override/*from w w w . j a v a2 s .c o m*/ public void onSingleTap(float x, float y) { if (bMapTap) { Point oPoint = myMapView.toMapPoint(x, y); if (mBusquedaLayer != null && myMapView.getLayerByID(mBusquedaLayer.getID()) != null) myMapView.removeLayer(mBusquedaLayer); if (mSeleccionLayer != null && myMapView.getLayerByID(mSeleccionLayer.getID()) != null) myMapView.removeLayer(mSeleccionLayer); if (bCallOut) { if (nIndentify > 0) { mSeleccionLayer = new GraphicsLayer(); SimpleMarkerSymbol resultSymbol = new SimpleMarkerSymbol(Color.GREEN, 12, SimpleMarkerSymbol.STYLE.CIRCLE); Graphic resultLocGraphic = new Graphic(oPoint, resultSymbol); mSeleccionLayer.addGraphic(resultLocGraphic); myMapView.addLayer(mSeleccionLayer); switch (nIndentify) { case 1: getCalleToDialog(oPoint); break; case 2: getTramoToDialog(oPoint); break; } } else { mSeleccionLayer = new GraphicsLayer(); int[] selectedFeatures = oLySelectAsoc.getGraphicIDs(x, y, calcRadio(), 1000); // select the features oLySelectAsoc.clearSelection(); oLySelectAsoc.setSelectedGraphics(selectedFeatures, true); Log.w("MapsActivity", "Selected Graphics " + selectedFeatures.length); if (selectedFeatures.length > 0) { Graphic[] results = oLySelectAsoc.getSelectedFeatures(); Callout mapCallout = myMapView.getCallout(); mapCallout.hide(); for (Graphic graphic : results) { Map<String, Object> attr = graphic.getAttributes(); Util oUtil = new Util(); CalloutTvClass oCall = oUtil.getCalloutValues(attr); GisTextView tv = new GisTextView(MapsActivity.this); tv.setText(oCall.getVista()); tv.setHint(oCall.getValor()); tv.setIdObjeto(oCall.getIdObjeto()); tv.setPoint((Point) graphic.getGeometry()); tv.setTipo("nueva"); tv.setTextColor(Color.WHITE); tv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { oTxtAsoc.setIdObjeto(((GisTextView) v).getIdObjeto()); oTxtAsoc.setText(((GisTextView) v).getHint()); oTxtAsoc.setTipo(((GisTextView) v).getTipo()); oTxtAsoc.setPoint(myMapView.getCallout().getCoordinates()); bCallOut = false; bMapTap = false; myMapView.getCallout().hide(); oLySelectAsoc.clearSelection(); dialogCrear.show(); if (mSeleccionLayer != null && myMapView.getLayerByID(mSeleccionLayer.getID()) != null) myMapView.removeLayer(mSeleccionLayer); // LINE PRINT if (mUbicacionLayer != null && oUbicacion != null) { SimpleLineSymbol lineSymbol = new SimpleLineSymbol(Color.BLUE, 4, SimpleLineSymbol.STYLE.DASH); Polyline oLine = new Polyline(); oLine.startPath(oUbicacion); oLine.lineTo(oTxtAsoc.getPoint()); Graphic graphicDireccion = new Graphic(oLine, lineSymbol, null); mUbicacionLayer.addGraphic(graphicDireccion); } } }); Point point = (Point) graphic.getGeometry(); mapCallout.setOffset(0, -3); mapCallout.setCoordinates(point); mapCallout.setMaxHeight(100); mapCallout.setMaxWidth(400); mapCallout.setStyle(R.xml.mycalloutprefs); mapCallout.setContent(tv); mapCallout.show(); } } else { getAsocObject(oPoint); } SimpleMarkerSymbol resultSymbol = new SimpleMarkerSymbol(Color.GREEN, 12, SimpleMarkerSymbol.STYLE.CIRCLE); Graphic resultLocGraphic = new Graphic(oPoint, resultSymbol); mSeleccionLayer.addGraphic(resultLocGraphic); myMapView.addLayer(mSeleccionLayer); } } else { if (mUbicacionLayer != null && myMapView.getLayerByID(mUbicacionLayer.getID()) != null) myMapView.removeLayer(mUbicacionLayer); oUbicacion = oPoint; mUbicacionLayer = new GraphicsLayer(); SimpleMarkerSymbol resultSymbol = new SimpleMarkerSymbol(Color.RED, 12, SimpleMarkerSymbol.STYLE.DIAMOND); Graphic resultLocGraphic = new Graphic(oPoint, resultSymbol); mUbicacionLayer.addGraphic(resultLocGraphic); myMapView.addLayer(mUbicacionLayer); if (R.layout.dialog_poste == idResLayoutSelect) { LyPOSTES.setVisible(true); if (LyPOSTES.getMinScale() < myMapView.getScale()) myMapView.zoomToScale(oPoint, LyPOSTES.getMinScale() * 0.9); } else if (R.layout.dialog_direccion == idResLayoutSelect) { LyDIRECCIONES.setVisible(true); if (LyDIRECCIONES.getMinScale() < myMapView.getScale()) myMapView.zoomToScale(oPoint, LyDIRECCIONES.getMinScale() * 0.9); } else if (R.layout.dialog_cliente == idResLayoutSelect || R.layout.dialog_cliente_cnr == idResLayoutSelect) { LyPOSTES.setVisible(true); LyDIRECCIONES.setVisible(true); LyCLIENTES.setVisible(true); if (idResLayoutSelect == R.layout.dialog_cliente_cnr) LyREDBT.setVisible(true); if (LyPOSTES.getMinScale() < myMapView.getScale()) myMapView.zoomToScale(oPoint, LyPOSTES.getMinScale() * 0.9); } else if (R.layout.form_lectores == idResLayoutSelect) { if (LyPOSTES.getMinScale() < myMapView.getScale()) myMapView.zoomToScale(oPoint, LyPOSTES.getMinScale() * 0.9); } } } else { if (bVerData) { double nExtendScale = myMapView.getScale(); double layerScala = 0; ArrayList<ArcGISDynamicMapServiceLayer> arrayLay = new ArrayList<>(); Point oPoint = myMapView.toMapPoint(x, y); if (oLyViewGraphs != null && myMapView.getLayerByID(oLyViewGraphs.getID()) != null) myMapView.removeLayer(oLyViewGraphs); oLyViewGraphs = new GraphicsLayer(); SimpleMarkerSymbol oMarketSymbol = new SimpleMarkerSymbol(Color.BLACK, 10, SimpleMarkerSymbol.STYLE.CIRCLE); oMarketSymbol.setOutline(new SimpleLineSymbol(Color.RED, 1, SimpleLineSymbol.STYLE.SOLID)); Graphic oGraph = new Graphic(oPoint, oMarketSymbol); oLyViewGraphs.addGraphic(oGraph); myMapView.addLayer(oLyViewGraphs); for (Layer oLayer : myMapView.getLayers()) { if ((oLayer.getName() != null && !oLayer.getName().equalsIgnoreCase("MapaBase")) && oLayer.isVisible()) { if (oLayer.getClass().equals(ArcGISDynamicMapServiceLayer.class)) { for (ArcGISLayerInfo arcGISLayerInfo : ((ArcGISDynamicMapServiceLayer) oLayer) .getLayers()) { if (arcGISLayerInfo.isVisible()) { layerScala = (arcGISLayerInfo.getMinScale() > 0) ? arcGISLayerInfo.getMinScale() : 0; break; } } layerScala = (layerScala > 0) ? layerScala : nExtendScale; if (nExtendScale <= layerScala) { arrayLay.add((ArcGISDynamicMapServiceLayer) oLayer); } } } } if (arrayLay.size() > 0) { ArcGISDynamicMapServiceLayer[] aLay = new ArcGISDynamicMapServiceLayer[arrayLay.size()]; aLay = arrayLay.toArray(aLay); getInfoObject(oPoint, aLay); } else { Toast.makeText(getApplicationContext(), "No hay capas visibles", Toast.LENGTH_SHORT) .show(); } } } } }); }
From source file:com.skytree.epubtest.BookViewActivity.java
public void fillHighlightList() { Theme theme = getCurrentTheme();/*w ww . ja v a2s .c o m*/ int textColor = theme.foregroundColor; this.listView.removeAllViews(); Highlights highlights = sd.fetchAllHighlights(this.bookCode); for (int i = 0; i < highlights.getSize(); i++) { Highlight highlight = highlights.getHighlight(i); SkyLayout item = new SkyLayout(this); int ci = highlight.chapterIndex; if (rv.isRTL()) { ci = rv.getNumberOfChapters() - ci - 1; } String chapterTitle = rv.getChapterTitle(ci); if (chapterTitle == null || chapterTitle.isEmpty()) chapterTitle = "Chapter " + ci; TextView chapterLabel = this.makeLabel(9899, chapterTitle, Gravity.LEFT, 16, textColor); setFrame(chapterLabel, ps(20), ps(5), this.listView.getWidth() - ps(20), ps(40)); item.addView(chapterLabel); GradientDrawable textGrad = new GradientDrawable(Orientation.TOP_BOTTOM, new int[] { getBrighterColor(highlight.color), getDarkerColor(highlight.color) }); TextView textLabel = this.makeLabel(9899, highlight.text, Gravity.LEFT, 16, Color.BLACK); setFrame(textLabel, ps(20), ps(5 + 40 + 5), this.listView.getWidth() - ps(20), ps(70)); textLabel.setBackgroundDrawable(textGrad); textLabel.getBackground().setAlpha(180); item.addView(textLabel); int noteHeight = 0; if (highlight.isNote && highlight.note != null && highlight.note.length() != 0 && !highlight.note.equalsIgnoreCase("null")) { TextView noteLabel = this.makeLabel(9899, highlight.note, Gravity.LEFT, 16, Color.BLACK); noteLabel.setTextColor(getDarkerColor(highlight.color)); noteHeight = 70; setFrame(noteLabel, ps(20), ps(5 + 40 + 5 + 70 + 5), this.listView.getWidth() - ps(20), ps(noteHeight)); item.addView(noteLabel); } TextView dateLabel = this.makeLabel(9899, highlight.datetime, Gravity.RIGHT, 12, textColor); int lw = this.listView.getWidth(); setFrame(dateLabel, 0, ps(5 + 40 + 5 + 70 + 5 + noteHeight + 5), lw, ps(40)); item.addView(dateLabel); int itemHeight = ps(5 + 40 + 5 + 90 + 5 + noteHeight + 5 + 15 + 5); View lineView = new View(this); lineView.setBackgroundColor(Color.LTGRAY); setFrame(lineView, 0, itemHeight - ps(1), this.listView.getWidth(), ps(1)); item.addView(lineView); setFrame(item, 0, 0, listView.getWidth(), itemHeight); item.setSkyLayoutListener(highlightListDelegate); item.setId(highlight.code); item.data = highlight; Button deleteButton = new Button(this); GradientDrawable grad = new GradientDrawable(Orientation.TOP_BOTTOM, new int[] { 0xffcf666e, 0xff671521 }); grad.setStroke(ps(2), 0xff282828); deleteButton.setBackgroundDrawable(grad); deleteButton.setText(getString(R.string.delete)); deleteButton.setTypeface(null, Typeface.BOLD); deleteButton.setTextColor(Color.WHITE); deleteButton.setTextSize(12); deleteButton.setId(highlight.code); deleteButton.setVisibility(View.INVISIBLE); deleteButton.setVisibility(View.GONE); deleteButton.setOnClickListener(deleteHighlightDelegate); int dw = ps(120); int dh = ps(50); setFrame(deleteButton, this.listView.getWidth() - dw, (itemHeight - dh) / 2, dw, dh); item.deleteControl = deleteButton; item.addView(deleteButton); this.listView.addView(item); } }
From source file:cl.gisred.android.CatastroActivity.java
private void singleTapOnMap() { myMapView.setOnSingleTapListener(new OnSingleTapListener() { @Override/*from w w w. jav a2 s . c om*/ public void onSingleTap(float x, float y) { if (bMapTap) { Point oPoint = myMapView.toMapPoint(x, y); if (mBusquedaLayer != null && myMapView.getLayerByID(mBusquedaLayer.getID()) != null) myMapView.removeLayer(mBusquedaLayer); if (mSeleccionLayer != null && myMapView.getLayerByID(mSeleccionLayer.getID()) != null) myMapView.removeLayer(mSeleccionLayer); if (bCallOut) { if (nIndentify > 0) { mSeleccionLayer = new GraphicsLayer(); SimpleMarkerSymbol resultSymbol = new SimpleMarkerSymbol(Color.GREEN, 12, SimpleMarkerSymbol.STYLE.CIRCLE); Graphic resultLocGraphic = new Graphic(oPoint, resultSymbol); mSeleccionLayer.addGraphic(resultLocGraphic); myMapView.addLayer(mSeleccionLayer); //TODO buscar tramo switch (nIndentify) { case 1: getCalleToDialog(oPoint); break; case 2: getTramoToDialog(oPoint); break; } } else { mSeleccionLayer = new GraphicsLayer(); int[] selectedFeatures = oLySelectAsoc.getGraphicIDs(x, y, calcRadio(), 1000); // select the features oLySelectAsoc.clearSelection(); oLySelectAsoc.setSelectedGraphics(selectedFeatures, true); Log.w("MapsActivity", "Selected Graphics " + selectedFeatures.length); if (selectedFeatures.length > 0) { Graphic[] results = oLySelectAsoc.getSelectedFeatures(); Callout mapCallout = myMapView.getCallout(); mapCallout.hide(); for (Graphic graphic : results) { Map<String, Object> attr = graphic.getAttributes(); Util oUtil = new Util(); CalloutTvClass oCall = oUtil.getCalloutValues(attr); GisTextView tv = new GisTextView(CatastroActivity.this); tv.setText(oCall.getVista()); tv.setHint(oCall.getValor()); tv.setIdObjeto(oCall.getIdObjeto()); tv.setPoint((Point) graphic.getGeometry()); tv.setTipo("nueva"); tv.setTextColor(Color.WHITE); tv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { oTxtAsoc.setIdObjeto(((GisTextView) v).getIdObjeto()); oTxtAsoc.setText(((GisTextView) v).getHint()); oTxtAsoc.setTipo(((GisTextView) v).getTipo()); oTxtAsoc.setPoint(myMapView.getCallout().getCoordinates()); bCallOut = false; bMapTap = false; myMapView.getCallout().hide(); oLySelectAsoc.clearSelection(); dialogCur.show(); if (mSeleccionLayer != null && myMapView.getLayerByID(mSeleccionLayer.getID()) != null) myMapView.removeLayer(mSeleccionLayer); // LINE PRINT if (mUbicacionLayer != null && oUbicacion != null) { SimpleLineSymbol lineSymbol = new SimpleLineSymbol(Color.BLUE, 4, SimpleLineSymbol.STYLE.DASH); Polyline oLine = new Polyline(); oLine.startPath(oUbicacion); oLine.lineTo(oTxtAsoc.getPoint()); Graphic graphicDireccion = new Graphic(oLine, lineSymbol, null); mUbicacionLayer.addGraphic(graphicDireccion); } } }); Point point = (Point) graphic.getGeometry(); mapCallout.setOffset(0, -3); mapCallout.setCoordinates(point); mapCallout.setMaxHeight(100); mapCallout.setMaxWidth(400); mapCallout.setStyle(R.xml.mycalloutprefs); mapCallout.setContent(tv); mapCallout.show(); } } else { getAsocObject(oPoint); } SimpleMarkerSymbol resultSymbol = new SimpleMarkerSymbol(Color.GREEN, 12, SimpleMarkerSymbol.STYLE.CIRCLE); Graphic resultLocGraphic = new Graphic(oPoint, resultSymbol); mSeleccionLayer.addGraphic(resultLocGraphic); myMapView.addLayer(mSeleccionLayer); } } else { if (mUbicacionLayer != null && myMapView.getLayerByID(mUbicacionLayer.getID()) != null) myMapView.removeLayer(mUbicacionLayer); oUbicacion = oPoint; mUbicacionLayer = new GraphicsLayer(); SimpleMarkerSymbol resultSymbol = new SimpleMarkerSymbol(Color.RED, 12, SimpleMarkerSymbol.STYLE.DIAMOND); Graphic resultLocGraphic = new Graphic(oPoint, resultSymbol); mUbicacionLayer.addGraphic(resultLocGraphic); myMapView.addLayer(mUbicacionLayer); if (R.layout.dialog_poste == idResLayoutSelect) { LyPOSTES.setVisible(true); if (LyPOSTES.getMinScale() < myMapView.getScale()) myMapView.zoomToScale(oPoint, LyPOSTES.getMinScale() * 0.9); } else if (R.layout.dialog_direccion == idResLayoutSelect) { LyDIRECCIONES.setVisible(true); if (LyDIRECCIONES.getMinScale() < myMapView.getScale()) myMapView.zoomToScale(oPoint, LyDIRECCIONES.getMinScale() * 0.9); } else if (R.layout.dialog_cliente == idResLayoutSelect || R.layout.dialog_cliente_cnr == idResLayoutSelect) { LyPOSTES.setVisible(true); LyDIRECCIONES.setVisible(true); LyCLIENTES.setVisible(true); if (idResLayoutSelect == R.layout.dialog_cliente_cnr) LyREDBT.setVisible(true); if (LyPOSTES.getMinScale() < myMapView.getScale()) myMapView.zoomToScale(oPoint, LyPOSTES.getMinScale() * 0.9); } else if (R.layout.form_lectores == idResLayoutSelect) { if (LyPOSTES.getMinScale() < myMapView.getScale()) myMapView.zoomToScale(oPoint, LyPOSTES.getMinScale() * 0.9); } } } else { if (bVerData) { double nExtendScale = myMapView.getScale(); double layerScala = 0; ArrayList<ArcGISDynamicMapServiceLayer> arrayLay = new ArrayList<>(); Point oPoint = myMapView.toMapPoint(x, y); if (oLyViewGraphs != null && myMapView.getLayerByID(oLyViewGraphs.getID()) != null) myMapView.removeLayer(oLyViewGraphs); oLyViewGraphs = new GraphicsLayer(); SimpleMarkerSymbol oMarketSymbol = new SimpleMarkerSymbol(Color.BLACK, 10, SimpleMarkerSymbol.STYLE.CIRCLE); oMarketSymbol.setOutline(new SimpleLineSymbol(Color.RED, 1, SimpleLineSymbol.STYLE.SOLID)); Graphic oGraph = new Graphic(oPoint, oMarketSymbol); oLyViewGraphs.addGraphic(oGraph); myMapView.addLayer(oLyViewGraphs); for (Layer oLayer : myMapView.getLayers()) { if ((oLayer.getName() != null && !oLayer.getName().equalsIgnoreCase("MapaBase")) && oLayer.isVisible()) { if (oLayer.getClass().equals(ArcGISDynamicMapServiceLayer.class)) { for (ArcGISLayerInfo arcGISLayerInfo : ((ArcGISDynamicMapServiceLayer) oLayer) .getLayers()) { if (arcGISLayerInfo.isVisible()) { layerScala = (arcGISLayerInfo.getMinScale() > 0) ? arcGISLayerInfo.getMinScale() : 0; break; } } layerScala = (layerScala > 0) ? layerScala : nExtendScale; Log.w("layerScala " + layerScala, "nExtendScale " + nExtendScale); if (nExtendScale <= layerScala) { arrayLay.add((ArcGISDynamicMapServiceLayer) oLayer); } } } } if (arrayLay.size() > 0) { ArcGISDynamicMapServiceLayer[] aLay = new ArcGISDynamicMapServiceLayer[arrayLay.size()]; aLay = arrayLay.toArray(aLay); getInfoObject(oPoint, aLay); } else { Toast.makeText(getApplicationContext(), "No hay capas visibles", Toast.LENGTH_SHORT) .show(); } } } } }); }
From source file:cl.gisred.android.OtRouteActivity.java
private void singleTapOnMap() { myMapView.setOnSingleTapListener(new OnSingleTapListener() { @Override//from w w w . j a v a 2 s .com public void onSingleTap(float x, float y) { if (bMapTap) { Point oPoint = myMapView.toMapPoint(x, y); if (mBusquedaLayer != null && myMapView.getLayerByID(mBusquedaLayer.getID()) != null) myMapView.removeLayer(mBusquedaLayer); if (mSeleccionLayer != null && myMapView.getLayerByID(mSeleccionLayer.getID()) != null) myMapView.removeLayer(mSeleccionLayer); if (bCallOut) { if (nIndentify > 0) { mSeleccionLayer = new GraphicsLayer(); SimpleMarkerSymbol resultSymbol = new SimpleMarkerSymbol(Color.GREEN, 12, SimpleMarkerSymbol.STYLE.CIRCLE); Graphic resultLocGraphic = new Graphic(oPoint, resultSymbol); mSeleccionLayer.addGraphic(resultLocGraphic); myMapView.addLayer(mSeleccionLayer); switch (nIndentify) { case 1: getCalleToDialog(oPoint); break; case 2: getTramoToDialog(oPoint); break; } } else { mSeleccionLayer = new GraphicsLayer(); int[] selectedFeatures = oLySelectAsoc.getGraphicIDs(x, y, calcRadio(), 1000); // select the features oLySelectAsoc.clearSelection(); oLySelectAsoc.setSelectedGraphics(selectedFeatures, true); if (selectedFeatures.length > 0) { Graphic[] results = oLySelectAsoc.getSelectedFeatures(); Callout mapCallout = myMapView.getCallout(); mapCallout.hide(); for (Graphic graphic : results) { Map<String, Object> attr = graphic.getAttributes(); Util oUtil = new Util(); CalloutTvClass oCall = oUtil.getCalloutValues(attr); GisTextView tv = new GisTextView(OtRouteActivity.this); tv.setText(oCall.getVista()); tv.setHint(oCall.getValor()); tv.setIdObjeto(oCall.getIdObjeto()); tv.setPoint((Point) graphic.getGeometry()); tv.setTipo("nueva"); tv.setTextColor(Color.WHITE); tv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { oTxtAsoc.setIdObjeto(((GisTextView) v).getIdObjeto()); oTxtAsoc.setText(((GisTextView) v).getHint()); oTxtAsoc.setTipo(((GisTextView) v).getTipo()); oTxtAsoc.setPoint(myMapView.getCallout().getCoordinates()); bCallOut = false; bMapTap = false; myMapView.getCallout().hide(); oLySelectAsoc.clearSelection(); dialogCur.show(); if (mSeleccionLayer != null && myMapView.getLayerByID(mSeleccionLayer.getID()) != null) myMapView.removeLayer(mSeleccionLayer); // LINE PRINT if (mUbicacionLayer != null && oUbicacion != null) { SimpleLineSymbol lineSymbol = new SimpleLineSymbol(Color.BLUE, 4, SimpleLineSymbol.STYLE.DASH); Polyline oLine = new Polyline(); oLine.startPath(oUbicacion); oLine.lineTo(oTxtAsoc.getPoint()); Graphic graphicDireccion = new Graphic(oLine, lineSymbol, null); mUbicacionLayer.addGraphic(graphicDireccion); } } }); Point point = (Point) graphic.getGeometry(); mapCallout.setOffset(0, -3); mapCallout.setCoordinates(point); mapCallout.setMaxHeight(100); mapCallout.setMaxWidth(400); mapCallout.setStyle(R.xml.mycalloutprefs); mapCallout.setContent(tv); mapCallout.show(); } } else { getAsocObject(oPoint); } SimpleMarkerSymbol resultSymbol = new SimpleMarkerSymbol(Color.GREEN, 12, SimpleMarkerSymbol.STYLE.CIRCLE); Graphic resultLocGraphic = new Graphic(oPoint, resultSymbol); mSeleccionLayer.addGraphic(resultLocGraphic); myMapView.addLayer(mSeleccionLayer); } } else { if (mUbicacionLayer != null && myMapView.getLayerByID(mUbicacionLayer.getID()) != null) myMapView.removeLayer(mUbicacionLayer); oUbicacion = oPoint; mUbicacionLayer = new GraphicsLayer(); SimpleMarkerSymbol resultSymbol = new SimpleMarkerSymbol(Color.RED, 12, SimpleMarkerSymbol.STYLE.DIAMOND); Graphic resultLocGraphic = new Graphic(oPoint, resultSymbol); mUbicacionLayer.addGraphic(resultLocGraphic); myMapView.addLayer(mUbicacionLayer); if (R.layout.dialog_poste == idResLayoutSelect) { LyPOSTES.setVisible(true); if (LyPOSTES.getMinScale() < myMapView.getScale()) myMapView.zoomToScale(oPoint, LyPOSTES.getMinScale() * 0.9); } else if (R.layout.dialog_direccion == idResLayoutSelect) { LyDIRECCIONES.setVisible(true); if (LyDIRECCIONES.getMinScale() < myMapView.getScale()) myMapView.zoomToScale(oPoint, LyDIRECCIONES.getMinScale() * 0.9); } else if (R.layout.dialog_cliente == idResLayoutSelect || R.layout.dialog_cliente_cnr == idResLayoutSelect) { LyPOSTES.setVisible(true); LyDIRECCIONES.setVisible(true); LyCLIENTES.setVisible(true); if (idResLayoutSelect == R.layout.dialog_cliente_cnr) LyREDBT.setVisible(true); if (LyPOSTES.getMinScale() < myMapView.getScale()) myMapView.zoomToScale(oPoint, LyPOSTES.getMinScale() * 0.9); } else if (R.layout.form_lectores == idResLayoutSelect) { if (LyPOSTES.getMinScale() < myMapView.getScale()) myMapView.zoomToScale(oPoint, LyPOSTES.getMinScale() * 0.9); } } } else { if (bVerData) { double nExtendScale = myMapView.getScale(); double layerScala = 0; ArrayList<ArcGISDynamicMapServiceLayer> arrayLay = new ArrayList<>(); Point oPoint = myMapView.toMapPoint(x, y); if (oLyViewGraphs != null && myMapView.getLayerByID(oLyViewGraphs.getID()) != null) myMapView.removeLayer(oLyViewGraphs); oLyViewGraphs = new GraphicsLayer(); SimpleMarkerSymbol oMarketSymbol = new SimpleMarkerSymbol(Color.BLACK, 10, SimpleMarkerSymbol.STYLE.CIRCLE); oMarketSymbol.setOutline(new SimpleLineSymbol(Color.RED, 1, SimpleLineSymbol.STYLE.SOLID)); Graphic oGraph = new Graphic(oPoint, oMarketSymbol); oLyViewGraphs.addGraphic(oGraph); myMapView.addLayer(oLyViewGraphs); for (Layer oLayer : myMapView.getLayers()) { if ((oLayer.getName() != null && !oLayer.getName().equalsIgnoreCase("MapaBase")) && oLayer.isVisible()) { if (oLayer.getClass().equals(ArcGISDynamicMapServiceLayer.class)) { for (ArcGISLayerInfo arcGISLayerInfo : ((ArcGISDynamicMapServiceLayer) oLayer) .getLayers()) { if (arcGISLayerInfo.isVisible()) { layerScala = (arcGISLayerInfo.getMinScale() > 0) ? arcGISLayerInfo.getMinScale() : 0; break; } } layerScala = (layerScala > 0) ? layerScala : nExtendScale; if (nExtendScale <= layerScala) { arrayLay.add((ArcGISDynamicMapServiceLayer) oLayer); } } } } if (arrayLay.size() > 0) { ArcGISDynamicMapServiceLayer[] aLay = new ArcGISDynamicMapServiceLayer[arrayLay.size()]; aLay = arrayLay.toArray(aLay); getInfoObject(oPoint, aLay); } else { Toast.makeText(getApplicationContext(), "No hay capas visibles", Toast.LENGTH_SHORT) .show(); } } } } }); }
From source file:com.ichi2.anki2.Reviewer.java
public void fillFlashcard(boolean flip) { if (!flip) {//from w ww . ja v a 2 s.c om Log.i(AnkiDroidApp.TAG, "base url = " + mBaseUrl); if (mCurrentSimpleInterface && mSimpleCard != null) { mSimpleCard.setText(mCardContent); } else if (mRefreshWebview && mCard != null && mNextCard != null) { mNextCard.setBackgroundColor(mCurrentBackgroundColor); mNextCard.loadDataWithBaseURL(mBaseUrl, mCardContent.toString(), "text/html", "utf-8", null); mNextCard.setVisibility(View.VISIBLE); mCardFrame.removeView(mCard); mCard.destroy(); mCard = mNextCard; mNextCard = createWebView(); mNextCard.setVisibility(View.GONE); mCardFrame.addView(mNextCard, 0); // hunt for input issue 720, like android issue 3341 if (AnkiDroidApp.SDK_VERSION <= 7) { mCard.setFocusableInTouchMode(true); } } else if (mCard != null) { mCard.loadDataWithBaseURL(mBaseUrl, mCardContent.toString(), "text/html", "utf-8", null); mCard.setBackgroundColor(mCurrentBackgroundColor); } if (mChangeBorderStyle) { switch (mCurrentBackgroundColor) { case Color.WHITE: if (mInvertedColors) { mInvertedColors = false; invertColors(false); } break; case Color.BLACK: if (!mInvertedColors) { mInvertedColors = true; invertColors(true); } break; default: if (Themes.getTheme() != Themes.THEME_BLUE) { mMainLayout.setBackgroundColor(mCurrentBackgroundColor); } if (mInvertedColors != mNightMode) { mInvertedColors = mNightMode; invertColors(mNightMode); } } } if (!mShowAnimations && mCardTimer.getVisibility() == View.INVISIBLE) { switchTopBarVisibility(View.VISIBLE); } if (!sDisplayAnswer) { updateForNewCard(); if (mShowWhiteboard) { mWhiteboard.clear(); } setNextCardAnimation(false); } } else { Animation3D rotation; boolean directionToLeft = true; switch (mNextAnimation) { case ANIMATION_TURN: rotation = new Animation3D(mCardContainer.getWidth(), mCardContainer.getHeight(), 9, Animation3D.ANIMATION_TURN, true, true, this); rotation.setDuration(mAnimationDurationTurn); rotation.setInterpolator(new AccelerateDecelerateInterpolator()); break; case ANIMATION_NEXT_CARD_FROM_LEFT: directionToLeft = false; case ANIMATION_NEXT_CARD_FROM_RIGHT: rotation = new Animation3D(mCardContainer.getWidth(), mCardContainer.getHeight(), 0, Animation3D.ANIMATION_EXCHANGE_CARD, directionToLeft, true, this); rotation.setDuration(mAnimationDurationMove); rotation.setInterpolator(new AccelerateDecelerateInterpolator()); break; case ANIMATION_SLIDE_OUT_TO_RIGHT: directionToLeft = false; case ANIMATION_SLIDE_OUT_TO_LEFT: fillFlashcard(false); rotation = new Animation3D(mCardContainer.getWidth(), mCardContainer.getHeight(), 0, Animation3D.ANIMATION_SLIDE_OUT_CARD, directionToLeft, true, this); rotation.setDuration(mAnimationDurationMove); rotation.setInterpolator(new AccelerateInterpolator()); switchTopBarVisibility(View.INVISIBLE); break; case ANIMATION_SLIDE_IN_FROM_LEFT: directionToLeft = false; case ANIMATION_SLIDE_IN_FROM_RIGHT: fillFlashcard(false); rotation = new Animation3D(mCardContainer.getWidth(), mCardContainer.getHeight(), 0, Animation3D.ANIMATION_SLIDE_IN_CARD, directionToLeft, true, this); rotation.setDuration(mAnimationDurationMove); rotation.setInterpolator(new DecelerateInterpolator()); switchTopBarVisibility(View.VISIBLE); break; case ANIMATION_NO_ANIMATION: default: return; } rotation.reset(); mCardContainer.setDrawingCacheEnabled(true); mCardContainer.setDrawingCacheBackgroundColor(Themes.getBackgroundColor()); mCardContainer.clearAnimation(); mCardContainer.startAnimation(rotation); } }
From source file:cl.gisred.android.MedidorActivity.java
private void singleTapOnMap() { myMapView.setOnSingleTapListener(new OnSingleTapListener() { @Override/*from w ww .j av a 2 s . c om*/ public void onSingleTap(float x, float y) { if (bMapTap) { Point oPoint = myMapView.toMapPoint(x, y); if (mBusquedaLayer != null && myMapView.getLayerByID(mBusquedaLayer.getID()) != null) myMapView.removeLayer(mBusquedaLayer); if (mSeleccionLayer != null && myMapView.getLayerByID(mSeleccionLayer.getID()) != null) myMapView.removeLayer(mSeleccionLayer); if (bCallOut) { if (nIndentify > 0) { mSeleccionLayer = new GraphicsLayer(); SimpleMarkerSymbol resultSymbol = new SimpleMarkerSymbol(Color.GREEN, 12, SimpleMarkerSymbol.STYLE.CIRCLE); Graphic resultLocGraphic = new Graphic(oPoint, resultSymbol); mSeleccionLayer.addGraphic(resultLocGraphic); myMapView.addLayer(mSeleccionLayer); //TODO buscar tramo switch (nIndentify) { case 1: getCalleToDialog(oPoint); break; case 2: getTramoToDialog(oPoint); break; } } else { mSeleccionLayer = new GraphicsLayer(); int[] selectedFeatures = oLySelectAsoc.getGraphicIDs(x, y, calcRadio(), 1000); // select the features oLySelectAsoc.clearSelection(); oLySelectAsoc.setSelectedGraphics(selectedFeatures, true); Log.w("MapsActivity", "Selected Graphics " + selectedFeatures.length); if (selectedFeatures.length > 0) { Graphic[] results = oLySelectAsoc.getSelectedFeatures(); Callout mapCallout = myMapView.getCallout(); mapCallout.hide(); for (Graphic graphic : results) { Map<String, Object> attr = graphic.getAttributes(); Util oUtil = new Util(); CalloutTvClass oCall = oUtil.getCalloutValues(attr); GisTextView tv = new GisTextView(MedidorActivity.this); tv.setText(oCall.getVista()); tv.setHint(oCall.getValor()); tv.setIdObjeto(oCall.getIdObjeto()); tv.setPoint((Point) graphic.getGeometry()); tv.setTipo("nueva"); tv.setTextColor(Color.WHITE); tv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { oTxtAsoc.setIdObjeto(((GisTextView) v).getIdObjeto()); oTxtAsoc.setText(((GisTextView) v).getHint()); oTxtAsoc.setTipo(((GisTextView) v).getTipo()); oTxtAsoc.setPoint(myMapView.getCallout().getCoordinates()); bCallOut = false; bMapTap = false; myMapView.getCallout().hide(); oLySelectAsoc.clearSelection(); dialogCur.show(); if (mSeleccionLayer != null && myMapView.getLayerByID(mSeleccionLayer.getID()) != null) myMapView.removeLayer(mSeleccionLayer); // LINE PRINT if (mUbicacionLayer != null && oUbicacion != null) { SimpleLineSymbol lineSymbol = new SimpleLineSymbol(Color.BLUE, 4, SimpleLineSymbol.STYLE.DASH); Polyline oLine = new Polyline(); oLine.startPath(oUbicacion); oLine.lineTo(oTxtAsoc.getPoint()); Graphic graphicDireccion = new Graphic(oLine, lineSymbol, null); mUbicacionLayer.addGraphic(graphicDireccion); } } }); Point point = (Point) graphic.getGeometry(); mapCallout.setOffset(0, -3); mapCallout.setCoordinates(point); mapCallout.setMaxHeight(100); mapCallout.setMaxWidth(400); mapCallout.setStyle(R.xml.mycalloutprefs); mapCallout.setContent(tv); mapCallout.show(); } } else { getAsocObject(oPoint); } SimpleMarkerSymbol resultSymbol = new SimpleMarkerSymbol(Color.GREEN, 12, SimpleMarkerSymbol.STYLE.CIRCLE); Graphic resultLocGraphic = new Graphic(oPoint, resultSymbol); mSeleccionLayer.addGraphic(resultLocGraphic); myMapView.addLayer(mSeleccionLayer); } } else { if (mUbicacionLayer != null && myMapView.getLayerByID(mUbicacionLayer.getID()) != null) myMapView.removeLayer(mUbicacionLayer); oUbicacion = oPoint; mUbicacionLayer = new GraphicsLayer(); SimpleMarkerSymbol resultSymbol = new SimpleMarkerSymbol(Color.RED, 12, SimpleMarkerSymbol.STYLE.DIAMOND); Graphic resultLocGraphic = new Graphic(oPoint, resultSymbol); mUbicacionLayer.addGraphic(resultLocGraphic); myMapView.addLayer(mUbicacionLayer); if (R.layout.dialog_poste == idResLayoutSelect) { LyPOSTES.setVisible(true); if (LyPOSTES.getMinScale() < myMapView.getScale()) myMapView.zoomToScale(oPoint, LyPOSTES.getMinScale() * 0.9); } else if (R.layout.dialog_direccion == idResLayoutSelect) { LyDIRECCIONES.setVisible(true); if (LyDIRECCIONES.getMinScale() < myMapView.getScale()) myMapView.zoomToScale(oPoint, LyDIRECCIONES.getMinScale() * 0.9); } else if (R.layout.dialog_cliente == idResLayoutSelect || R.layout.dialog_cliente_cnr == idResLayoutSelect) { LyPOSTES.setVisible(true); LyDIRECCIONES.setVisible(true); LyCLIENTES.setVisible(true); if (idResLayoutSelect == R.layout.dialog_cliente_cnr) LyREDBT.setVisible(true); if (LyPOSTES.getMinScale() < myMapView.getScale()) myMapView.zoomToScale(oPoint, LyPOSTES.getMinScale() * 0.9); } else if (R.layout.form_lectores == idResLayoutSelect) { if (LyPOSTES.getMinScale() < myMapView.getScale()) myMapView.zoomToScale(oPoint, LyPOSTES.getMinScale() * 0.9); } } } else { if (bVerData) { double nExtendScale = myMapView.getScale(); double layerScala = 0; ArrayList<ArcGISDynamicMapServiceLayer> arrayLay = new ArrayList<>(); Point oPoint = myMapView.toMapPoint(x, y); if (oLyViewGraphs != null && myMapView.getLayerByID(oLyViewGraphs.getID()) != null) myMapView.removeLayer(oLyViewGraphs); oLyViewGraphs = new GraphicsLayer(); SimpleMarkerSymbol oMarketSymbol = new SimpleMarkerSymbol(Color.BLACK, 10, SimpleMarkerSymbol.STYLE.CIRCLE); oMarketSymbol.setOutline(new SimpleLineSymbol(Color.RED, 1, SimpleLineSymbol.STYLE.SOLID)); Graphic oGraph = new Graphic(oPoint, oMarketSymbol); oLyViewGraphs.addGraphic(oGraph); myMapView.addLayer(oLyViewGraphs); for (Layer oLayer : myMapView.getLayers()) { if ((oLayer.getName() != null && !oLayer.getName().equalsIgnoreCase("MapaBase")) && oLayer.isVisible()) { if (oLayer.getClass().equals(ArcGISDynamicMapServiceLayer.class)) { for (ArcGISLayerInfo arcGISLayerInfo : ((ArcGISDynamicMapServiceLayer) oLayer) .getLayers()) { if (arcGISLayerInfo.isVisible()) { layerScala = (arcGISLayerInfo.getMinScale() > 0) ? arcGISLayerInfo.getMinScale() : 0; break; } } layerScala = (layerScala > 0) ? layerScala : nExtendScale; Log.w("layerScala " + layerScala, "nExtendScale " + nExtendScale); if (nExtendScale <= layerScala) { arrayLay.add((ArcGISDynamicMapServiceLayer) oLayer); } } } } if (arrayLay.size() > 0) { ArcGISDynamicMapServiceLayer[] aLay = new ArcGISDynamicMapServiceLayer[arrayLay.size()]; aLay = arrayLay.toArray(aLay); getInfoObject(oPoint, aLay); } else { Toast.makeText(getApplicationContext(), "No hay capas visibles", Toast.LENGTH_SHORT) .show(); } } } } }); }
From source file:cl.gisred.android.LectorActivity.java
private void singleTapOnMap() { myMapView.setOnSingleTapListener(new OnSingleTapListener() { @Override//ww w .java 2 s . c o m public void onSingleTap(float x, float y) { if (bMapTap) { Point oPoint = myMapView.toMapPoint(x, y); if (mBusquedaLayer != null && myMapView.getLayerByID(mBusquedaLayer.getID()) != null) myMapView.removeLayer(mBusquedaLayer); if (mSeleccionLayer != null && myMapView.getLayerByID(mSeleccionLayer.getID()) != null) myMapView.removeLayer(mSeleccionLayer); if (bCallOut) { if (nIndentify > 0) { mSeleccionLayer = new GraphicsLayer(); SimpleMarkerSymbol resultSymbol = new SimpleMarkerSymbol(Color.GREEN, 12, SimpleMarkerSymbol.STYLE.CIRCLE); Graphic resultLocGraphic = new Graphic(oPoint, resultSymbol); mSeleccionLayer.addGraphic(resultLocGraphic); myMapView.addLayer(mSeleccionLayer); switch (nIndentify) { case 1: getCalleToDialog(oPoint); break; case 2: getTramoToDialog(oPoint); break; } } else { mSeleccionLayer = new GraphicsLayer(); int[] selectedFeatures = oLySelectAsoc.getGraphicIDs(x, y, calcRadio(), 1000); // select the features oLySelectAsoc.clearSelection(); oLySelectAsoc.setSelectedGraphics(selectedFeatures, true); if (selectedFeatures.length > 0) { Graphic[] results = oLySelectAsoc.getSelectedFeatures(); Callout mapCallout = myMapView.getCallout(); mapCallout.hide(); for (Graphic graphic : results) { Map<String, Object> attr = graphic.getAttributes(); Util oUtil = new Util(); CalloutTvClass oCall = oUtil.getCalloutValues(attr); GisTextView tv = new GisTextView(LectorActivity.this); tv.setText(oCall.getVista()); tv.setHint(oCall.getValor()); tv.setIdObjeto(oCall.getIdObjeto()); tv.setPoint((Point) graphic.getGeometry()); tv.setTipo("nueva"); tv.setTextColor(Color.WHITE); tv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { oTxtAsoc.setIdObjeto(((GisTextView) v).getIdObjeto()); oTxtAsoc.setText(((GisTextView) v).getHint()); oTxtAsoc.setTipo(((GisTextView) v).getTipo()); oTxtAsoc.setPoint(myMapView.getCallout().getCoordinates()); bCallOut = false; bMapTap = false; myMapView.getCallout().hide(); oLySelectAsoc.clearSelection(); dialogCur.show(); if (mSeleccionLayer != null && myMapView.getLayerByID(mSeleccionLayer.getID()) != null) myMapView.removeLayer(mSeleccionLayer); // LINE PRINT if (mUbicacionLayer != null && oUbicacion != null) { SimpleLineSymbol lineSymbol = new SimpleLineSymbol(Color.BLUE, 4, SimpleLineSymbol.STYLE.DASH); Polyline oLine = new Polyline(); oLine.startPath(oUbicacion); oLine.lineTo(oTxtAsoc.getPoint()); Graphic graphicDireccion = new Graphic(oLine, lineSymbol, null); mUbicacionLayer.addGraphic(graphicDireccion); } } }); Point point = (Point) graphic.getGeometry(); mapCallout.setOffset(0, -3); mapCallout.setCoordinates(point); mapCallout.setMaxHeight(100); mapCallout.setMaxWidth(400); mapCallout.setStyle(R.xml.mycalloutprefs); mapCallout.setContent(tv); mapCallout.show(); } } else { getAsocObject(oPoint); } SimpleMarkerSymbol resultSymbol = new SimpleMarkerSymbol(Color.GREEN, 12, SimpleMarkerSymbol.STYLE.CIRCLE); Graphic resultLocGraphic = new Graphic(oPoint, resultSymbol); mSeleccionLayer.addGraphic(resultLocGraphic); myMapView.addLayer(mSeleccionLayer); } } else { if (mUbicacionLayer != null && myMapView.getLayerByID(mUbicacionLayer.getID()) != null) myMapView.removeLayer(mUbicacionLayer); oUbicacion = oPoint; mUbicacionLayer = new GraphicsLayer(); SimpleMarkerSymbol resultSymbol = new SimpleMarkerSymbol(Color.RED, 12, SimpleMarkerSymbol.STYLE.DIAMOND); Graphic resultLocGraphic = new Graphic(oPoint, resultSymbol); mUbicacionLayer.addGraphic(resultLocGraphic); myMapView.addLayer(mUbicacionLayer); if (R.layout.dialog_poste == idResLayoutSelect) { LyPOSTES.setVisible(true); if (LyPOSTES.getMinScale() < myMapView.getScale()) myMapView.zoomToScale(oPoint, LyPOSTES.getMinScale() * 0.9); } else if (R.layout.dialog_direccion == idResLayoutSelect) { LyDIRECCIONES.setVisible(true); if (LyDIRECCIONES.getMinScale() < myMapView.getScale()) myMapView.zoomToScale(oPoint, LyDIRECCIONES.getMinScale() * 0.9); } else if (R.layout.dialog_cliente == idResLayoutSelect || R.layout.dialog_cliente_cnr == idResLayoutSelect) { LyPOSTES.setVisible(true); LyDIRECCIONES.setVisible(true); LyCLIENTES.setVisible(true); if (idResLayoutSelect == R.layout.dialog_cliente_cnr) LyREDBT.setVisible(true); if (LyPOSTES.getMinScale() < myMapView.getScale()) myMapView.zoomToScale(oPoint, LyPOSTES.getMinScale() * 0.9); } else if (R.layout.form_lectores == idResLayoutSelect) { if (LyPOSTES.getMinScale() < myMapView.getScale()) myMapView.zoomToScale(oPoint, LyPOSTES.getMinScale() * 0.9); } } } else { if (bVerData) { double nExtendScale = myMapView.getScale(); double layerScala = 0; ArrayList<ArcGISDynamicMapServiceLayer> arrayLay = new ArrayList<>(); Point oPoint = myMapView.toMapPoint(x, y); if (oLyViewGraphs != null && myMapView.getLayerByID(oLyViewGraphs.getID()) != null) myMapView.removeLayer(oLyViewGraphs); oLyViewGraphs = new GraphicsLayer(); SimpleMarkerSymbol oMarketSymbol = new SimpleMarkerSymbol(Color.BLACK, 10, SimpleMarkerSymbol.STYLE.CIRCLE); oMarketSymbol.setOutline(new SimpleLineSymbol(Color.RED, 1, SimpleLineSymbol.STYLE.SOLID)); Graphic oGraph = new Graphic(oPoint, oMarketSymbol); oLyViewGraphs.addGraphic(oGraph); myMapView.addLayer(oLyViewGraphs); for (Layer oLayer : myMapView.getLayers()) { if ((oLayer.getName() != null && !oLayer.getName().equalsIgnoreCase("MapaBase")) && oLayer.isVisible()) { if (oLayer.getClass().equals(ArcGISDynamicMapServiceLayer.class)) { for (ArcGISLayerInfo arcGISLayerInfo : ((ArcGISDynamicMapServiceLayer) oLayer) .getLayers()) { if (arcGISLayerInfo.isVisible()) { layerScala = (arcGISLayerInfo.getMinScale() > 0) ? arcGISLayerInfo.getMinScale() : 0; break; } } layerScala = (layerScala > 0) ? layerScala : nExtendScale; Log.w("layerScala " + layerScala, "nExtendScale " + nExtendScale); if (nExtendScale <= layerScala) { arrayLay.add((ArcGISDynamicMapServiceLayer) oLayer); } } } } if (arrayLay.size() > 0) { ArcGISDynamicMapServiceLayer[] aLay = new ArcGISDynamicMapServiceLayer[arrayLay.size()]; aLay = arrayLay.toArray(aLay); getInfoObject(oPoint, aLay); } else { Toast.makeText(getApplicationContext(), "No hay capas visibles", Toast.LENGTH_SHORT) .show(); } } } } }); }
From source file:com.hichinaschool.flashcards.anki.Reviewer.java
public void fillFlashcard(boolean flip) { if (!flip) {/*from ww w . jav a 2s .co m*/ // Log.i(AnkiDroidApp.TAG, "base url = " + mBaseUrl); if (mCurrentSimpleInterface && mSimpleCard != null) { mSimpleCard.setText(mCardContent); } else if (!mUseQuickUpdate && mCard != null && mNextCard != null) { mNextCard.setBackgroundColor(mCurrentBackgroundColor); mNextCard.loadDataWithBaseURL(mBaseUrl, mCardContent.toString(), "text/html", "utf-8", null); mNextCard.setVisibility(View.VISIBLE); mCardFrame.removeView(mCard); mCard.destroy(); mCard = mNextCard; mNextCard = createWebView(); mNextCard.setVisibility(View.GONE); mCardFrame.addView(mNextCard, 0); // hunt for input issue 720, like android issue 3341 if (AnkiDroidApp.SDK_VERSION <= 7) { mCard.setFocusableInTouchMode(true); } } else if (mCard != null) { mCard.loadDataWithBaseURL(mBaseUrl, mCardContent.toString(), "text/html", "utf-8", null); mCard.setBackgroundColor(mCurrentBackgroundColor); } if (mChangeBorderStyle) { switch (mCurrentBackgroundColor) { case Color.WHITE: if (mInvertedColors) { mInvertedColors = false; invertColors(false); } break; case Color.BLACK: if (!mInvertedColors) { mInvertedColors = true; invertColors(true); } break; default: if (Themes.getTheme() != Themes.THEME_BLUE) { mMainLayout.setBackgroundColor(mCurrentBackgroundColor); } if (mInvertedColors != mNightMode) { mInvertedColors = mNightMode; invertColors(mNightMode); } } } if (!mShowAnimations && mShowTimer && mCardTimer.getVisibility() == View.INVISIBLE) { switchTopBarVisibility(View.VISIBLE); } if (!sDisplayAnswer) { updateForNewCard(); if (mShowWhiteboard) { mWhiteboard.clear(); } setNextCardAnimation(false); } } else { Animation3D rotation; boolean directionToLeft = true; switch (mNextAnimation) { case ANIMATION_TURN: rotation = new Animation3D(mCardContainer.getWidth(), mCardContainer.getHeight(), 9, Animation3D.ANIMATION_TURN, true, true, this); rotation.setDuration(mAnimationDurationTurn); rotation.setInterpolator(new AccelerateDecelerateInterpolator()); break; case ANIMATION_NEXT_CARD_FROM_LEFT: directionToLeft = false; case ANIMATION_NEXT_CARD_FROM_RIGHT: rotation = new Animation3D(mCardContainer.getWidth(), mCardContainer.getHeight(), 0, Animation3D.ANIMATION_EXCHANGE_CARD, directionToLeft, true, this); rotation.setDuration(mAnimationDurationMove); rotation.setInterpolator(new AccelerateDecelerateInterpolator()); break; case ANIMATION_SLIDE_OUT_TO_RIGHT: directionToLeft = false; case ANIMATION_SLIDE_OUT_TO_LEFT: fillFlashcard(false); rotation = new Animation3D(mCardContainer.getWidth(), mCardContainer.getHeight(), 0, Animation3D.ANIMATION_SLIDE_OUT_CARD, directionToLeft, true, this); rotation.setDuration(mAnimationDurationMove); rotation.setInterpolator(new AccelerateInterpolator()); switchTopBarVisibility(View.INVISIBLE); break; case ANIMATION_SLIDE_IN_FROM_LEFT: directionToLeft = false; case ANIMATION_SLIDE_IN_FROM_RIGHT: fillFlashcard(false); rotation = new Animation3D(mCardContainer.getWidth(), mCardContainer.getHeight(), 0, Animation3D.ANIMATION_SLIDE_IN_CARD, directionToLeft, true, this); rotation.setDuration(mAnimationDurationMove); rotation.setInterpolator(new DecelerateInterpolator()); switchTopBarVisibility(View.VISIBLE); break; case ANIMATION_NO_ANIMATION: default: return; } rotation.reset(); mCardContainer.setDrawingCacheEnabled(true); mCardContainer.setDrawingCacheBackgroundColor(Themes.getBackgroundColor()); mCardContainer.clearAnimation(); mCardContainer.startAnimation(rotation); } }