/// <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 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 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() + " )"); } }
/// <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); } }