@Override public String getYName() { return placemark != null ? placemark.getLabel() : "Cursor"; }
private void writeGcpGeoCoding(GcpGeoCoding gcpGeoCoding, String nodeType, StringBuffer sb) { sb.append("\n"); sb.append("\nThe ").append(nodeType).append( " uses a geo-coding which is based on ground control points (GCPs).\n"); sb.append("\n"); ProductNodeGroup<Placemark> gcpGroup = getProduct().getGcpGroup(); String formatString = "%1$-18s \t%2$s\n"; sb.append(String.format(formatString, "Number Of GCPs:", String.valueOf(gcpGroup.getNodeCount()))); sb.append(String.format(formatString, "Function:", String.valueOf(gcpGeoCoding.getMethod()))); sb.append(String.format(formatString, "Datum:", String.valueOf(gcpGeoCoding.getDatum().getName()))); sb.append(String.format(formatString, "Latitude RMSE:", String.valueOf(gcpGeoCoding.getRmseLat()))); sb.append(String.format(formatString, "Longitude RMSE:", String.valueOf(gcpGeoCoding.getRmseLon()))); sb.append("\n"); sb.append("Table of used GCPs:\n"); Placemark[] gcps = gcpGroup.toArray(new Placemark[0]); formatString = "%1$-10s \t%2$-15s \t%3$-10s \t%4$-10s \t%5$-18s \t%6$-18s\n"; sb.append(String.format(formatString, "Number", "Label", "X", "Y", "Latitude", "Longitude")); for (int i = 0; i < gcps.length; i++) { Placemark gcp = gcps[i]; PixelPos pixelPos = gcp.getPixelPos(); GeoPos geoPos = gcp.getGeoPos(); sb.append(String.format(formatString, String.valueOf(i), gcp.getLabel(), String.valueOf(pixelPos.getX()), String.valueOf(pixelPos.getY()), geoPos.getLatString(), geoPos.getLonString())); } }
private String setUpRow(Placemark pin, List<Band> bandList) { Band refBand = bandList.get(0); final StringBuilder row = new StringBuilder(); row.append(pin.getLabel()); row.append(getSeparator()); PixelPos pixelPos = pin.getPixelPos(); if (exportImageCoords) { exportImageCoords(row, pixelPos); } if (exportLonLat) { exportLatLon(refBand, row, pixelPos); } row.append(AbstractTimeSeries.rasterToVariableName(refBand.getName())); row.append(getSeparator()); if (exportUnit) { row.append(refBand.getUnit()); row.append(getSeparator()); } for (int i = 0; i < bandList.size(); i++) { Band band = bandList.get(i); row.append(getValue(band, (int) pixelPos.x, (int) pixelPos.y, level)); if (i < bandList.size() - 1) { row.append(getSeparator()); } } return row.toString(); }
private List<TimeSeries> computeRasterTimeSeries() { final List<Position> positionsToDisplay = new ArrayList<Position>(); final ArrayList<String> positionNames = new ArrayList<String>(); if (type.equals(TimeSeriesType.PIN)) { final Placemark[] pinPositionsToDisplay = dataSources.getPinPositionsToDisplay(); for (Placemark namedGeoPos : pinPositionsToDisplay) { positionsToDisplay.add(positionSupport.transformGeoPos(namedGeoPos.getGeoPos())); positionNames.add(namedGeoPos.getLabel()); } } else if (showCursorTimeSeries && cursorPosition != null) { positionsToDisplay.add(cursorPosition); positionNames.add(""); } final Set<String> aliasNames = displayAxisMapping.getAliasNames(); final List<TimeSeries> rasterTimeSeries = new ArrayList<TimeSeries>(); for (int i = 0, positionsToDisplaySize = positionsToDisplay.size(); i < positionsToDisplaySize; i++) { final Position position = positionsToDisplay.get(i); final String positionName = positionNames.get(i); for (String aliasName : aliasNames) { final List<String> rasterNames = displayAxisMapping.getRasterNames(aliasName); for (String rasterName : rasterNames) { final List<Band> bandsForVariable = timeSeries.getBandsForVariable(rasterName); final TimeSeries timeSeries = computeSingleTimeSeries(bandsForVariable, position.pixelX, position.pixelY, position.currentLevel, positionName); rasterTimeSeries.add(dataHandler.getValidatedTimeSeries(timeSeries, rasterName, type)); } } } return rasterTimeSeries; }
Color pinColor = PlacemarkUtils.getPlacemarkColor(pin, getCurrentView()); for (DisplayableSpectrum spectrum : spectra) { XYSeries series = new XYSeries(spectrum.getName() + "_" + pin.getLabel()); final Band[] spectralBands = spectrum.getSelectedBands(); Map<Band, Double> bandToEnergy;
private List<TimeSeries> computeInsituTimeSeries() { final InsituSource insituSource = timeSeries.getInsituSource(); final List<TimeSeries> insituTimeSeries = new ArrayList<TimeSeries>(); final Set<String> aliasNames = displayAxisMapping.getAliasNames(); final Placemark[] pinPositionsToDisplay = dataSources.getPinPositionsToDisplay(); for (Placemark insituPin : pinPositionsToDisplay) { for (String aliasName : aliasNames) { final List<String> insituNames = displayAxisMapping.getInsituNames(aliasName); for (String insituName : insituNames) { // todo final GeoPos insituGeoposFor = timeSeries.getInsituGeoposFor(insituPin); if (insituGeoposFor != null) { InsituRecord[] insituRecords = insituSource.getValuesFor(insituName, insituGeoposFor); final TimeSeries timeSeries = computeSingleTimeSeries(insituRecords, insituName + "_" + insituPin.getLabel()); insituTimeSeries.add(dataHandler.getValidatedTimeSeries(timeSeries, insituName, type)); } } } } return insituTimeSeries; }
public void testLabelSettings() { Placemark p = Placemark.createPointPlacemark(PinDescriptor.getInstance(), "rallamann", "rallamann", "", null, new GeoPos(), product.getGeoCoding()); assertEquals("rallamann", p.getName()); assertEquals("rallamann", p.getLabel()); p.setLabel("schanteri"); assertEquals("rallamann", p.getName()); assertEquals("schanteri", p.getLabel()); p.setLabel(null); assertEquals("", p.getLabel()); p.setLabel(""); assertEquals("", p.getLabel()); } }
private void writeGcpGeoCoding(GcpGeoCoding gcpGeoCoding, String nodeType) { addEmptyRow(); addRow("The " + nodeType + " uses a geo-coding which is based on ground control points (GCPs)."); addEmptyRow(); ProductNodeGroup<Placemark> gcpGroup = getProduct().getGcpGroup(); addRow("Number Of GCPs", String.valueOf(gcpGroup.getNodeCount())); addRow("Function", String.valueOf(gcpGeoCoding.getMethod())); addRow("Datum", String.valueOf(gcpGeoCoding.getDatum().getName())); addRow("Latitude RMSE", String.valueOf(gcpGeoCoding.getRmseLat())); addRow("Longitude RMSE", String.valueOf(gcpGeoCoding.getRmseLon())); addEmptyRow(); addRow("Table of used GCPs"); Placemark[] gcps = gcpGroup.toArray(new Placemark[0]); addRow("Number", "Label", "X", "Y", "Latitude", "Longitude"); for (int i = 0; i < gcps.length; i++) { Placemark gcp = gcps[i]; PixelPos pixelPos = gcp.getPixelPos(); GeoPos geoPos = gcp.getGeoPos(); addRow(String.valueOf(i), gcp.getLabel(), String.valueOf(pixelPos.getX()), String.valueOf(pixelPos.getY()), geoPos.getLatString(), geoPos.getLonString()); } setFirstColumnWidth(40); }
values[2] = expectedPlacemark.getGeoPos().lon; values[3] = expectedPlacemark.getGeoPos().lat; values[4] = expectedPlacemark.getLabel(); long dateInMillis = (long) (Math.random() * Long.MAX_VALUE); dateInMillis -= dateInMillis % 1000; // only second accuracy
return dLat; case 6: return placemark.getLabel(); default: return "";
@Test public void testReadPlacemarkTextFileWithDateTimeFromConstantInput() throws Exception { final StringWriter stringWriter = new StringWriter(WRITER_INITIAL_SIZE); PrintWriter writer = new PrintWriter(stringWriter); writer.printf("Name Lat Lon DateTime%n"); writer.printf("One 59.885 10.664 2005-04-18T17:53:58%n"); writer.printf("Two 59.883 10.657 2006-08-06T12:54:58%n"); writer.printf("Three 59.88 10.65 2007-09-01T07:55:58%n"); List<Placemark> actualPlacemarks = PlacemarkIO.readPlacemarks(new StringReader(stringWriter.toString()), GEO_CODING, PinDescriptor.getInstance()); assertEquals(3, actualPlacemarks.size()); final Placemark mark1 = actualPlacemarks.get(0); assertEquals("One", mark1.getLabel()); assertDateTime(mark1, 2005, 3, 18, 17, 53, 58); assertEquals(59.885, mark1.getGeoPos().getLat(), 1.0e-3); assertEquals(10.664, mark1.getGeoPos().getLon(), 1.0e-3); final Placemark mark2 = actualPlacemarks.get(1); assertEquals("Two", mark2.getLabel()); assertDateTime(mark2, 2006, 7, 6, 12, 54, 58); assertEquals(59.883, mark2.getGeoPos().getLat(), 1.0e-3); assertEquals(10.657, mark2.getGeoPos().getLon(), 1.0e-3); final Placemark mark3 = actualPlacemarks.get(2); assertEquals("Three", mark3.getLabel()); assertDateTime(mark3, 2007, 8, 1, 7, 55, 58); assertEquals(59.88, mark3.getGeoPos().getLat(), 1.0e-3); assertEquals(10.65, mark3.getGeoPos().getLon(), 1.0e-3); }
Placemark newPlacemark = Placemark.createPointPlacemark(placemark.getDescriptor(), placemark.getName(), placemark.getLabel(), placemark.getDescription(), placemark.getPixelPos(),
private void testReadStandardResult(List<Placemark> expectedPlacemarks, List<Placemark> actualPlacemarks, PlacemarkDescriptor descriptorInstance) { for (int i = 0; i < actualPlacemarks.size(); i++) { Placemark actualPlacemark = actualPlacemarks.get(i); Placemark expectedPlacemark = expectedPlacemarks.get(i); assertNotSame(expectedPlacemark, actualPlacemark); assertEquals(expectedPlacemark.getName(), actualPlacemark.getName()); assertEquals(expectedPlacemark.getLabel(), actualPlacemark.getLabel()); assertEquals(expectedPlacemark.getPixelPos(), actualPlacemark.getPixelPos()); assertEquals(expectedPlacemark.getGeoPos(), actualPlacemark.getGeoPos()); assertEquals(expectedPlacemark.getDescription(), actualPlacemark.getDescription()); PlacemarkDescriptor descriptor = expectedPlacemark.getDescriptor(); assertEquals(descriptor.getRoleLabel(), descriptorInstance.getRoleLabel()); } }
values[2] = expectedPlacemark.getGeoPos().lon; values[3] = expectedPlacemark.getGeoPos().lat; values[4] = expectedPlacemark.getLabel(); for (int j = stdColumnName.length; j < values.length; j++) { values[j] = Math.random();
return PlacemarkUtils.getPlacemarkColor(placemark); case labelIndex: return placemark.getLabel(); default: return "";
public static void writeXML(Placemark placemark, XmlWriter writer, int indent) { Guardian.assertNotNull("writer", writer); Guardian.assertGreaterThan("indent", indent, -1); final String[][] attributes = {new String[]{DimapProductConstants.ATTRIB_NAME, placemark.getName()}}; final String[] pinTags = XmlWriter.createTags(indent, DimapProductConstants.TAG_PLACEMARK, attributes); writer.println(pinTags[0]); indent++; writer.printLine(indent, DimapProductConstants.TAG_PLACEMARK_LABEL, placemark.getLabel()); writer.printLine(indent, DimapProductConstants.TAG_PLACEMARK_DESCRIPTION, placemark.getDescription()); final GeoPos geoPos = placemark.getGeoPos(); if (geoPos != null) { writer.printLine(indent, DimapProductConstants.TAG_PLACEMARK_LATITUDE, geoPos.lat); writer.printLine(indent, DimapProductConstants.TAG_PLACEMARK_LONGITUDE, geoPos.lon); } final PixelPos pixelPos = placemark.getPixelPos(); if (pixelPos != null && pixelPos.isValid()) { writer.printLine(indent, DimapProductConstants.TAG_PLACEMARK_PIXEL_X, pixelPos.x); writer.printLine(indent, DimapProductConstants.TAG_PLACEMARK_PIXEL_Y, pixelPos.y); } final String styleCss = placemark.getStyleCss(); if (styleCss != null && !styleCss.isEmpty()) { writer.printLine(indent, DimapProductConstants.TAG_PLACEMARK_STYLE_CSS, styleCss); } writer.println(pinTags[1]); }
@Override public LegendItemCollection getLegendItems() { LegendItemCollection itemCollection = new LegendItemCollection(); final Placemark[] displayedPins = getDisplayedPins(); final List<DisplayableSpectrum> spectra = getSelectedSpectra(); for (Placemark pin : displayedPins) { Paint pinPaint = PlacemarkUtils.getPlacemarkColor(pin, getCurrentView()); for (DisplayableSpectrum spectrum : spectra) { if (spectrum.hasSelectedBands()) { String legendLabel = pin.getLabel() + "_" + spectrum.getName(); LegendItem item = createLegendItem(spectrum, pinPaint, legendLabel); itemCollection.add(item); } } } if (isShowingCursorSpectrum() && hasValidCursorPosition()) { for (DisplayableSpectrum spectrum : spectra) { if (spectrum.hasSelectedBands()) { Paint defaultPaint = Color.BLACK; LegendItem item = createLegendItem(spectrum, defaultPaint, spectrum.getName()); itemCollection.add(item); } } } return itemCollection; }
void copyActivePlacemark() { Guardian.assertNotNull("product", product); Placemark activePlacemark = getSelectedPlacemark(); Guardian.assertNotNull("activePlacemark", activePlacemark); Placemark newPlacemark = Placemark.createPointPlacemark(activePlacemark.getDescriptor(), "copy_of_" + activePlacemark.getName(), activePlacemark.getLabel(), activePlacemark.getDescription(), activePlacemark.getPixelPos(), activePlacemark.getGeoPos(), activePlacemark.getProduct().getGeoCoding()); newPlacemark.setStyleCss(activePlacemark.getStyleCss()); if (PlacemarkDialog.showEditPlacemarkDialog(getPaneWindow(), product, newPlacemark, placemarkDescriptor)) { makePlacemarkNameUnique(newPlacemark); updateUIState(); } }
+ " </Point>\n" + "</Placemark>\n", placemark.getLabel(), geoPos.lon, geoPos.lat);
dialog.getJDialog().setName(titlePrefix + "_" + roleLabel); dialog.setName(placemark.getName()); dialog.setLabel(placemark.getLabel()); dialog.setDescription(placemark.getDescription() != null ? placemark.getDescription() : "");