/// <summary> /// 인자로 수신한 정보로 스타일 생성 /// </summary> /// <param name="styleName"></param> /// <param name="iconScale"></param> /// <param name="a"></param> /// <param name="r"></param> /// <param name="g"></param> /// <param name="b"></param> /// <returns></returns> private IKmlStyle MakeStyle(string styleName, float iconScale, int a, int r, int g, int b) { IKmlStyle style = ge.createStyle(styleName); IKmlIconStyle iconStyle = style.getIconStyle(); iconStyle.setScale(iconScale); IKmlIcon icon = iconStyle.getIcon(); icon.setHref("http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png"); IKmlVec2 hotSpot = iconStyle.getHotSpot(); hotSpot.setX(20); hotSpot.setY(2); IKmlLineStyle lineStyle = style.getLineStyle(); /*IKmlColor lineColor = lineStyle.getColor(); * lineColor.setA(255); * lineColor.setR(0); * lineColor.setG(0); * lineColor.setB(0);*/ lineStyle.setWidth(2F); IKmlPolyStyle polyStyle = style.getPolyStyle(); IKmlColor color = polyStyle.getColor(); color.setA(a); color.setR(r); color.setG(g); color.setB(b); return(style); }
public void highlight(String name) { if (p_highlight != "") { de_highlight(); } IKmlFolder trip = getByName(name); IKmlPlacemark s_point = getStart(trip); IKmlPlacemark f_point = getFinish(trip); if (s_point == f_point) { return; } String col = ((IKmlPlacemark)trip.getFeatures().getChildNodes().item(0)).getComputedStyle().getIconStyle().getColor().get(); IKmlIcon icon = ge.createIcon(""); icon.setHref(@"http://maps.google.com/mapfiles/kml/paddle/wht-blank.png"); IKmlStyle ssty = ge.createStyle(""); ssty.getIconStyle().setIcon(icon); ssty.getIconStyle().setScale((float)0.9); ssty.getIconStyle().getColor().set(col); s_point.setStyleSelector(ssty); f_point.setStyleSelector(ssty); p_highlight = name; }
public IKmlStyle mkStyle(String col, String shape, float size) { IKmlIcon icon = ge.createIcon(""); icon.setHref(shape); IKmlStyle style = ge.createStyle(""); style.getIconStyle().getColor().set(col); style.getIconStyle().setIcon(icon); style.getIconStyle().setScale(size); return(style); }
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 highlight(IKmlPlacemark point) { de_highlight(); IKmlIcon icon = ge.createIcon(""); icon.setHref(@"http://maps.google.com/mapfiles/kml/paddle/wht-blank.png"); IKmlStyle ssty = ge.createStyle(""); ssty.getIconStyle().setIcon(icon); ssty.getIconStyle().setScale((float)0.9); ssty.getIconStyle().getColor().set(point.getComputedStyle().getIconStyle().getColor().get()); point.setStyleSelector(ssty); sel_point = point; }
/// <summary> /// Icon을 생성하여 GEPlugin 에 Append /// </summary> /// <param name="placemarkID"></param> /// <param name="iconName"></param> /// <param name="iconURL"></param> /// <param name="latitude"></param> /// <param name="longitude"></param> public void CreateSystemIcon(string placemarkID, string iconName, string iconUrl, double latitude, double longitude) { try { if (this.ge == null) { FileLogManager.GetInstance().WriteLog("[GEController] CreateSystemIcon( GEPlugin is null. )"); throw new Exception("External Exception : GEPlugin is null."); } //아이콘 생성---------------------------------------시작 IKmlPlacemark placemark = ge.createPlacemark("icon" + placemarkID); placemark.setDescription(iconName); if (!string.IsNullOrEmpty(iconUrl)) { //아이콘 스타일 변경----------------------------시작 IKmlIcon icon = ge.createIcon(""); icon.setHref(iconUrl); IKmlStyle style = ge.createStyle(""); style.getIconStyle().setIcon(icon); placemark.setStyleSelector(style); //아이콘 스타일 변경------------------------------끝 } else { //아이콘 스타일 변경----------------------------시작 IKmlIcon icon = ge.createIcon(""); icon.setHref("http://maps.google.com/mapfiles/kml/paddle/red-circle.png"); IKmlStyle style = ge.createStyle(""); style.getIconStyle().setIcon(icon); placemark.setStyleSelector(style); //아이콘 스타일 변경------------------------------끝 } IKmlPoint point = ge.createPoint(""); point.setLatitude(latitude); point.setLongitude(longitude); placemark.setGeometry(point); ge.getFeatures().appendChild(placemark); //아이콘 생성-----------------------------------------끝 } catch (Exception ex) { System.Console.WriteLine("CreateSystemIcon Exception : " + ex.ToString()); FileLogManager.GetInstance().WriteLog("[GEController] CreateSystemIcon( " + ex.ToString() + " )"); } }
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 = ""; } }
public void SetIconUrl(IKmlPlacemark placemark, string iconUrl, bool isSelect) { try { if (this.ge == null) { FileLogManager.GetInstance().WriteLog("[GEController] SetIconUrl( GEPlugin is null. )"); throw new Exception("External Exception : GEPlugin is null."); } string url = iconUrl; //아이콘 스타일 변경----------------------------시작 IKmlIcon icon = ge.createIcon(""); if (isSelect) { if (!url.Contains("_preferences")) { url = url.Split('.')[0] + "_preferences." + url.Split('.')[1]; } } else { if (url.Contains("_preferences")) { url = url.Replace("_preferences", ""); } } icon.setHref(url); IKmlStyle style = ge.createStyle(""); style.getIconStyle().setIcon(icon); placemark.setStyleSelector(style); //아이콘 스타일 변경------------------------------끝 } catch (Exception ex) { System.Console.WriteLine("SetIconUrl Exception : " + ex.ToString()); FileLogManager.GetInstance().WriteLog("[GEController] SetIconUrl( " + ex.ToString() + " )"); } }
public void AddPoint(GeoCoordinate gc, bool createNew, bool resetPath) { // Some constants string pathColor = "ff00ffff"; float pathWidth = 2; var ridingPathFolder = (IKmlFolder)ge.getElementById("ridingPath"); if (ridingPathFolder == null) { if (createNew) { ridingPathFolder = ge.createFolder("ridingPath"); ge.getFeatures().appendChild(ridingPathFolder); // ridingPathStyle = ge.createStyle("ridingPathStyle"); ridingPathStyle.getLineStyle().getColor().set(pathColor); ridingPathStyle.getLineStyle().setWidth(pathWidth); } else { return; } } if (resetPath) { ResetPath(); } if (pointsInSection == 0) // Create new Placemark with new LineString { // Create the placemark var lineStringPlacemark = ge.createPlacemark(""); // Create the LineString this.currentSection = ge.createLineString(""); lineStringPlacemark.setGeometry(this.currentSection); this.currentSection.setExtrude(0); this.currentSection.setTessellate(1); this.currentSection.setAltitudeMode(ge.ALTITUDE_CLAMP_TO_GROUND); // Add the feature to Earth ridingPathFolder.getFeatures().appendChild(lineStringPlacemark); lineStringPlacemark.setStyleSelector(ridingPathStyle); } if (pointsInSection++ >= 65000) { pointsInSection = 0; } this.currentSection.getCoordinates().pushLatLngAlt(gc.Latitude, gc.Longitude, 0); //=================// // Handle 3D model // //=================// if (this.ShowModel == true && this.geWebBrowser != null) { LoadTrainModel(); double azimuth = 0; if (this.ridingPath.Count > 1) { double p_lat = this.ridingPath[this.ridingPath.Count - 1].Latitude; double p_lon = this.ridingPath[this.ridingPath.Count - 1].Longitude; FC.GEPluginCtrls.Geo.Coordinate p_c = new FC.GEPluginCtrls.Geo.Coordinate(latitude: p_lat, longitude: p_lon); FC.GEPluginCtrls.Geo.Coordinate c = new FC.GEPluginCtrls.Geo.Coordinate(latitude: gc.Latitude, longitude: gc.Longitude); azimuth = FC.GEPluginCtrls.Geo.Maths.BearingInitial(p_c, c); } SetTrainModel(gc.Latitude, gc.Longitude, azimuth); } this.ridingPath.Add(gc); }
/* * 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; }
/// <summary> /// 모든 스타일 맵 생성 /// </summary> public void MakeAllStyleMap() { #region 흰색 IKmlStyle styleNormal = MakeStyle("st_n_white", 1.1F, 20, 255, 255, 255); IKmlStyle styleHighlight = MakeStyle("st_h_white", 1.3F, 20, 255, 255, 255); IKmlStyleMap styleMap = ge.createStyleMap("stm_white"); styleMap.setStyle(styleNormal, styleHighlight); dicStyleMap.Add(EColorStyle.WHITE, styleMap); #endregion #region 빨강 styleNormal = MakeStyle("st_n_red", 1.1F, 127, 255, 0, 0); styleHighlight = MakeStyle("st_h_red", 1.3F, 127, 255, 0, 0); styleMap = ge.createStyleMap("stm_red"); styleMap.setStyle(styleNormal, styleHighlight); dicStyleMap.Add(EColorStyle.RED, styleMap); #endregion #region 랑 styleNormal = MakeStyle("st_n_blue", 1.1F, 127, 0, 0, 255); styleHighlight = MakeStyle("st_h_blue", 1.3F, 127, 0, 0, 255); styleMap = ge.createStyleMap("stm_blue"); styleMap.setStyle(styleNormal, styleHighlight); dicStyleMap.Add(EColorStyle.BLUE, styleMap); #endregion #region PALEGOLDENROD styleNormal = MakeStyle("st_n_palegoldenrod", 1.1F, 127, 210, 206, 152); styleHighlight = MakeStyle("st_h_alegoldenrod", 1.3F, 127, 210, 206, 152); styleMap = ge.createStyleMap("stm_alegoldenrod"); styleMap.setStyle(styleNormal, styleHighlight); dicStyleMap.Add(EColorStyle.PALEGOLDENROD, styleMap); #endregion #region GOLD styleNormal = MakeStyle("st_n_gold", 1.1F, 127, 254, 224, 78); styleHighlight = MakeStyle("st_h_gold", 1.3F, 127, 254, 224, 78); styleMap = ge.createStyleMap("stm_gold"); styleMap.setStyle(styleNormal, styleHighlight); dicStyleMap.Add(EColorStyle.GOLD, styleMap); #endregion #region ORANGE styleNormal = MakeStyle("st_n_orange", 1.1F, 127, 255, 125, 00); styleHighlight = MakeStyle("st_h_orange", 1.3F, 127, 255, 125, 00); styleMap = ge.createStyleMap("stm_orange"); styleMap.setStyle(styleNormal, styleHighlight); dicStyleMap.Add(EColorStyle.ORANGE, styleMap); #endregion #region BRIGHTRED styleNormal = MakeStyle("st_n_brightred", 1.1F, 127, 255, 52, 52); styleHighlight = MakeStyle("st_h_brightred", 1.3F, 127, 255, 52, 52); styleMap = ge.createStyleMap("stm_brightred"); styleMap.setStyle(styleNormal, styleHighlight); dicStyleMap.Add(EColorStyle.BRIGHTRED, styleMap); #endregion #region DEEPPINK styleNormal = MakeStyle("st_n_deeppink", 1.1F, 127, 232, 09, 142); styleHighlight = MakeStyle("st_h_deeppink", 1.3F, 127, 232, 09, 142); styleMap = ge.createStyleMap("stm_deeppink"); styleMap.setStyle(styleNormal, styleHighlight); dicStyleMap.Add(EColorStyle.DEEPPINK, styleMap); #endregion #region PURPLE styleNormal = MakeStyle("st_n_purple", 1.1F, 127, 151, 28, 147); styleHighlight = MakeStyle("st_h_purple", 1.3F, 127, 151, 28, 147); styleMap = ge.createStyleMap("stm_purple"); styleMap.setStyle(styleNormal, styleHighlight); dicStyleMap.Add(EColorStyle.PURPLE, styleMap); #endregion #region ROYALBLUE styleNormal = MakeStyle("st_n_royalblue", 1.1F, 127, 59, 94, 225); styleHighlight = MakeStyle("st_h_royalblue", 1.3F, 127, 59, 94, 225); styleMap = ge.createStyleMap("stm_royalblue"); styleMap.setStyle(styleNormal, styleHighlight); dicStyleMap.Add(EColorStyle.ROYALBLUE, styleMap); #endregion #region DODGERBLUE styleNormal = MakeStyle("st_n_dodgerblue", 1.1F, 127, 59, 150, 227); styleHighlight = MakeStyle("st_h_dodgerblue", 1.3F, 127, 59, 150, 227); styleMap = ge.createStyleMap("stm_dodgerblue"); styleMap.setStyle(styleNormal, styleHighlight); dicStyleMap.Add(EColorStyle.DODGERBLUE, styleMap); #endregion #region MEDIUMTURQUOISE styleNormal = MakeStyle("st_n_mediumturquoise", 1.1F, 127, 96, 208, 218); styleHighlight = MakeStyle("st_h_mediumturquoise", 1.3F, 127, 96, 208, 218); styleMap = ge.createStyleMap("stm_mediumturquoise"); styleMap.setStyle(styleNormal, styleHighlight); dicStyleMap.Add(EColorStyle.MEDIUMTURQUOISE, styleMap); #endregion #region LIMEGREEN styleNormal = MakeStyle("st_n_limegreen", 1.1F, 127, 103, 206, 62); styleHighlight = MakeStyle("st_h_limegreen", 1.3F, 127, 103, 206, 62); styleMap = ge.createStyleMap("stm_limegreen"); styleMap.setStyle(styleNormal, styleHighlight); dicStyleMap.Add(EColorStyle.LIMEGREEN, styleMap); #endregion }
/* * 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); }
/// <summary> /// Icon을 생성하여 GEPlugin 에 Append /// </summary> /// <param name="iconInfo"></param> public IKmlObject CreateSystemIcon(IconInfo iconInfo) { try { if (this.ge == null) { FileLogManager.GetInstance().WriteLog("[GEController] CreateSystemIcon2( GEPlugin is null. )"); throw new Exception("External Exception : GEPlugin is null."); } StringBuilder builder = new StringBuilder(); builder.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); builder.Append("<kml xmlns=\"http://www.opengis.net/kml/2.2\" xmlns:gx=\"http://www.google.com/kml/ext/2.2\""); builder.Append(" xmlns:kml=\"http://www.opengis.net/kml/2.2\" xmlns:atom=\"http://www.w3.org/2005/Atom\">"); builder.Append("<Placemark id=\""); builder.Append("icon" + iconInfo.IconName); builder.Append("\">"); builder.Append("<name></name>"); if (iconInfo.LstExtendedData.Count > 0) { builder.Append("<ExtendedData>"); foreach (KmlExtendedData extendData in iconInfo.LstExtendedData) { builder.Append("<Data name=\""); builder.Append(extendData.DataName); builder.Append("\">"); builder.Append("<value>"); builder.Append(extendData.Data); builder.Append("</value>"); builder.Append("</Data>"); } builder.Append("</ExtendedData>"); } builder.Append("</Placemark>"); builder.Append("</kml>"); IKmlObject obj = ge.parseKml(builder.ToString()); //아이콘 생성---------------------------------------시작 IKmlPlacemark placemark = obj as IKmlPlacemark; placemark.setDescription(iconInfo.IconName); if (!string.IsNullOrEmpty(iconInfo.IconURL)) { //아이콘 스타일 변경----------------------------시작 IKmlIcon icon = ge.createIcon(""); icon.setHref(iconInfo.IconURL); IKmlStyle style = ge.createStyle(""); style.getIconStyle().setIcon(icon); placemark.setStyleSelector(style); //아이콘 스타일 변경------------------------------끝 } else { //아이콘 스타일 변경----------------------------시작 IKmlIcon icon = ge.createIcon(""); icon.setHref("http://maps.google.com/mapfiles/kml/paddle/red-circle.png"); IKmlStyle style = ge.createStyle(""); style.getIconStyle().setIcon(icon); placemark.setStyleSelector(style); //아이콘 스타일 변경------------------------------끝 } IKmlPoint point = ge.createPoint(""); point.setLatitude(iconInfo.Latitude); point.setLongitude(iconInfo.Longitude); placemark.setGeometry(point); return(ge.getFeatures().appendChild(placemark)); //아이콘 생성-----------------------------------------끝 } catch (Exception ex) { System.Console.WriteLine("CreateSystemIcon2 Exception : " + ex.ToString()); FileLogManager.GetInstance().WriteLog("[GEController] CreateSystemIcon2( GEPlugin is null. )"); return(null); } }
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); }