public bool de_highlight() { if (sel_point != null) { IKmlStyleMap sm = ge.createStyleMap(""); IKmlStyle normal = mkStyle(sel_point.getComputedStyle().getIconStyle().getColor().get(), @"http://maps.google.com/mapfiles/kml/paddle/wht-blank.png", (float)0.3); IKmlStyle highlight = mkStyle(sel_point.getComputedStyle().getIconStyle().getColor().get(), @"http://maps.google.com/mapfiles/kml/paddle/wht-blank.png", (float)0.4); sm.setNormalStyle(normal); sm.setHighlightStyle(highlight); sel_point.setStyleSelector(sm); return(true); } return(false); }
public void addToEnd(string name, IKmlPlacemark point) { IKmlFolder trip = getByName(name); IKmlObjectList points = trip.getFeatures().getChildNodes(); String col = ((IKmlPlacemark)trip.getFeatures().getChildNodes().item(2)).getComputedStyle().getIconStyle().getColor().get(); IKmlStyleMap sm = ge.createStyleMap(""); IKmlStyle normal = mkStyle(col, @"http://maps.google.com/mapfiles/kml/paddle/wht-blank.png", (float)0.3); IKmlStyle highlight = mkStyle(col, @"http://maps.google.com/mapfiles/kml/paddle/wht-blank.png", (float)0.4); sm.setNormalStyle(normal); sm.setHighlightStyle(highlight); point.setStyleSelector(sm); trip.getFeatures().appendChild(point); }
public String ch_col(String name, String col) { IKmlStyleMap sm = ge.createStyleMap(""); IKmlStyle normal = mkStyle(col, @"http://maps.google.com/mapfiles/kml/paddle/wht-blank.png", (float)0.3); IKmlStyle highlight = mkStyle(col, @"http://maps.google.com/mapfiles/kml/paddle/wht-blank.png", (float)0.4); sm.setNormalStyle(normal); sm.setHighlightStyle(highlight); IKmlFolder trip = getByName(name); IKmlObjectList points = trip.getFeatures().getChildNodes(); String temp = ((IKmlPlacemark)points.item(0)).getComputedStyle().getIconStyle().getColor().get(); for (int i = 0; i < points.getLength(); i++) { IKmlPlacemark pt = (IKmlPlacemark)points.item(i); pt.setStyleSelector(sm); } return(temp); }
public void de_highlight() { if (p_highlight != "") { IKmlPlacemark p_s_point = getStart(getByName(p_highlight)); IKmlPlacemark p_f_point = getFinish(getByName(p_highlight)); String col = ((IKmlPlacemark)getByName(p_highlight).getFeatures().getChildNodes().item(0)).getComputedStyle().getIconStyle().getColor().get(); IKmlStyleMap sm = ge.createStyleMap(""); IKmlStyle normal = mkStyle(col, @"http://maps.google.com/mapfiles/kml/paddle/wht-blank.png", (float)0.3); IKmlStyle highlight = mkStyle(col, @"http://maps.google.com/mapfiles/kml/paddle/wht-blank.png", (float)0.4); sm.setNormalStyle(normal); sm.setHighlightStyle(highlight); p_s_point.setStyleSelector(sm); p_f_point.setStyleSelector(sm); p_highlight = ""; } }
/* * insert a trip into trippool and remove the trip at the same index as well as the one after ( this is used by join ) */ public String insert(String name, IKmlFolder trip, String[] att, IKmlStyle sty) { de_highlight(); int index = int.Parse(name.Split('_')[1]); String style = ""; IKmlFolder temp1 = getByName("Trip_" + index); IKmlFolder temp2 = getByName("Trip_" + (index + 1)); IKmlObjectList points = temp1.getFeatures().getChildNodes(); for (int ii = 0; ii != points.getLength(); ii++) { IKmlPlacemark point = (IKmlPlacemark)points.item(ii); trip.getFeatures().appendChild(point); if (ii == 0) { style = point.getComputedStyle().getIconStyle().getColor().get(); } } points = temp2.getFeatures().getChildNodes(); IKmlStyleMap sm = ge.createStyleMap(""); IKmlStyle normal = mkStyle(style, @"http://maps.google.com/mapfiles/kml/paddle/wht-blank.png", (float)0.3); IKmlStyle highlight = mkStyle(style, @"http://maps.google.com/mapfiles/kml/paddle/wht-blank.png", (float)0.4); sm.setNormalStyle(normal); sm.setHighlightStyle(highlight); for (int ii = 0; ii != points.getLength(); ii++) { IKmlPlacemark point = (IKmlPlacemark)points.item(ii); if (ii == 0) { _style = point.getComputedStyle().getIconStyle().getColor().get(); } if (point.getGeometry().getType() != "KmlPoint") { point.getComputedStyle().getLineStyle().setWidth((float)4); point.getComputedStyle().getLineStyle().getColor().set(style); } else { point.setStyleSelector(sm); } trip.getFeatures().appendChild(point); } _core.RemoveAt(index - 1); // _attr.RemoveAt(index - 1); // removeKMLTrip(index.ToString()); _core.RemoveAt(index - 1); //_attr.RemoveAt(index - 1); // removeKMLTrip(index.ToString()); _core.Insert(index - 1, trip); // _attr.Insert(index - 1, att); // addAtPosition(trip, index - 1); return(_style); }
public Boolean insert(String tp1, String tp2) { try { // Get the end placemark of the 1st trip and the start placemark of the second trip IKmlPlacemark tp1fn = t_pool.getFinish(t_pool.getByName(tp1)); IKmlPlacemark tp2st = t_pool.getStart(t_pool.getByName(tp2)); //create a place mark to store the new place mark IKmlPlacemark start = ge.createPlacemark(""); IKmlPlacemark finish = ge.createPlacemark(""); start.setName(tp1fn.getName()); finish.setName(tp2st.getName()); IKmlPoint sp = ge.createPoint(""); IKmlPoint fp = ge.createPoint(""); IKmlPlacemark _temp = ge.createPlacemark(""); IKmlLineString temp = ge.createLineString(""); // Retrieve the coordinates of the two trips Hashtable cds1 = Module.getCoordinates(tp1fn); Hashtable cds2 = Module.getCoordinates(tp2st); sp.setLatLng((double)cds1["lat"], (double)cds1["lon"]); start.setGeometry(sp); fp.setLatLng((double)cds2["lat"], (double)cds2["lon"]); finish.setGeometry(fp); String color = randomCol(); IKmlStyleMap sm = ge.createStyleMap(""); IKmlStyle normal = mkStyle(color, @"http://maps.google.com/mapfiles/kml/paddle/wht-blank.png", (float)0.3); IKmlStyle highlight = mkStyle(color, @"http://maps.google.com/mapfiles/kml/paddle/wht-blank.png", (float)0.4); sm.setNormalStyle(normal); sm.setHighlightStyle(highlight); start.setStyleSelector(sm); finish.setStyleSelector(sm); temp.getCoordinates().pushLatLngAlt((double)cds1["lat"], (double)cds1["lon"], 0); temp.getCoordinates().pushLatLngAlt((double)cds2["lat"], (double)cds2["lon"], 0); _temp.setGeometry(temp); IKmlStyle sty = ge.createStyle(""); sty.getLineStyle().setWidth((float)4); sty.getLineStyle().getColor().set(color); _temp.setStyleSelector(sty); //create a new KML folder for the new trip and append the tmp features of the previous trip IKmlFolder temp1 = ge.createFolder(""); temp1.getFeatures().appendChild(start); temp1.getFeatures().appendChild(_temp); temp1.getFeatures().appendChild(finish); String[] attributes = new String[14]; //Add the new trip to the trip pools t_pool.add(tp2, temp1, attributes); ge.getFeatures().appendChild(temp1); // record the insert action for undo action record.ins_trip(tp2); return(true); } catch { return(false); } }
public IKmlFolder[] split(int index, IKmlFolder raw, IKmlPlacemark _point, String style) { IKmlFolder[] output = new IKmlFolder[2]; String col = randomCol(); IKmlFolder temp1 = ge.createFolder(""); IKmlFolder temp2 = ge.createFolder(""); temp1.setName("Trip_" + (index).ToString()); temp2.setName("Trip_" + (index + 1).ToString()); int sw = 0; IKmlObjectList points = raw.getFeatures().getChildNodes(); for (int i = 0; i != points.getLength(); i++) { IKmlPlacemark point = (IKmlPlacemark)points.item(i); if (point.getName() == _point.getName()) { sw = 1; } if (sw == 0) { temp1.getFeatures().appendChild(point); } else { IKmlStyleMap sm = ge.createStyleMap(""); if (style != null) { if (point.getGeometry().getType() != "KmlPoint") { IKmlStyle sty = ge.createStyle(""); sty.getLineStyle().setWidth((float)4); sty.getLineStyle().getColor().set(style); point.setStyleSelector(sty); } else { IKmlStyle normal = mkStyle(style, @"http://maps.google.com/mapfiles/kml/paddle/wht-blank.png", (float)0.3); IKmlStyle highlight = mkStyle(style, @"http://maps.google.com/mapfiles/kml/paddle/wht-blank.png", (float)0.4); sm.setNormalStyle(normal); sm.setHighlightStyle(highlight); point.setStyleSelector(sm); } } else { if (point.getGeometry().getType() != "KmlPoint") { IKmlStyle sty = ge.createStyle(""); sty.getLineStyle().setWidth((float)4); sty.getLineStyle().getColor().set(col); point.setStyleSelector(sty); } else { IKmlStyle normal = mkStyle(col, @"http://maps.google.com/mapfiles/kml/paddle/wht-blank.png", (float)0.3); IKmlStyle highlight = mkStyle(col, @"http://maps.google.com/mapfiles/kml/paddle/wht-blank.png", (float)0.4); sm.setNormalStyle(normal); sm.setHighlightStyle(highlight); point.setStyleSelector(sm); } } temp2.getFeatures().appendChild(point); } } output[0] = temp1; output[1] = temp2; return(output); }