本文整理汇总了C#中Document.AddFeature方法的典型用法代码示例。如果您正苦于以下问题:C# Document.AddFeature方法的具体用法?C# Document.AddFeature怎么用?C# Document.AddFeature使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Document
的用法示例。
在下文中一共展示了Document.AddFeature方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: writeKML
private void writeKML(string filename)
{
Color[] colours = { Color.Red, Color.Orange, Color.Yellow, Color.Green, Color.Blue, Color.Indigo, Color.Violet, Color.Pink };
Document kml = new Document();
Tour tour = new Tour();
tour.Name = "First Person View";
Playlist tourplaylist = new Playlist();
AddNamespace(kml, "gx", "http://www.google.com/kml/ext/2.2");
Style style = new Style();
style.Id = "yellowLineGreenPoly";
style.Line = new LineStyle(new Color32(HexStringToColor("7f00ffff")), 4);
PolygonStyle pstyle = new PolygonStyle();
pstyle.Color = new Color32(HexStringToColor("7f00ff00"));
style.Polygon = pstyle;
kml.AddStyle(style);
// create sub folders
Folder planes = new Folder();
planes.Name = "Planes";
kml.AddFeature(planes);
// coords for line string
CoordinateCollection coords = new CoordinateCollection();
int a = 1;
int c = -1;
DateTime lasttime = DateTime.MaxValue;
DateTime starttime = DateTime.MinValue;
Color stylecolor = Color.AliceBlue;
string mode = "";
if (flightdata.Count > 0)
{
mode = flightdata[0].mode;
}
foreach (CurrentState cs in flightdata)
{
progressBar1.Value = 50 + (int)((float)a / (float)flightdata.Count * 100.0f / 2.0f);
progressBar1.Refresh();
if (starttime == DateTime.MinValue)
{
starttime = cs.datetime;
lasttime = cs.datetime;
}
if (mode != cs.mode || flightdata.Count == a)
{
c++;
LineString ls = new LineString();
ls.AltitudeMode = SharpKml.Dom.AltitudeMode.Absolute;
ls.Extrude = true;
ls.Coordinates = coords;
Placemark pm = new Placemark();
pm.Name = c + " Flight Path " + mode;
pm.StyleUrl = new Uri("#yellowLineGreenPoly", UriKind.Relative);
pm.Geometry = ls;
SharpKml.Dom.TimeSpan ts = new SharpKml.Dom.TimeSpan();
ts.Begin = starttime;
ts.End = cs.datetime;
pm.Time = ts;
// setup for next line
mode = cs.mode;
starttime = cs.datetime;
stylecolor = colours[c % (colours.Length - 1)];
Style style2 = new Style();
style2.Line = new LineStyle(new Color32(stylecolor), 4);
pm.StyleSelector = style2;
kml.AddFeature(pm);
coords = new CoordinateCollection();
}
coords.Add(new Vector(cs.lat, cs.lng, cs.alt));
SharpKml.Dom.Timestamp tstamp = new SharpKml.Dom.Timestamp();
tstamp.When = cs.datetime;
FlyTo flyto = new FlyTo();
flyto.Duration = (cs.datetime - lasttime).TotalMilliseconds / 1000.0;
flyto.Mode = FlyToMode.Smooth;
SharpKml.Dom.Camera cam = new SharpKml.Dom.Camera();
//.........这里部分代码省略.........
示例2: CreateReportFiles
//.........这里部分代码省略.........
swloctrim.WriteElementString("Temperature", "");
swloctrim.WriteElementString("PPM", "");
swloctrim.WriteElementString("ApplyEarthCurvatureCorrection", "false");
swloctrim.WriteElementString("ApplyRefractionCorrection", "false");
swloctrim.WriteElementString("RefractionCoefficient", "0");
swloctrim.WriteElementString("PressureInputMethod", "ReadFromInstrument");
swloctrim.WriteEndElement();
swloctel.WriteLine("version=1");
swloctel.WriteLine("#seconds offset - " + offset);
swloctel.WriteLine("#longitude and latitude - in degrees");
swloctel.WriteLine("#name utc longitude latitude height");
swloctxt.WriteLine("#name longitude/X latitude/Y height/Z yaw pitch roll");
TXT_outputlog.AppendText("Start Processing\n");
// Dont know why but it was 10 in the past so let it be. Used to generate jxl file simulating x100 from trimble
int lastRecordN = JXL_ID_OFFSET;
// path
CoordinateCollection coords = new CoordinateCollection();
foreach (var item in vehicleLocations.Values)
{
coords.Add(new SharpKml.Base.Vector(item.Lat, item.Lon, item.AltAMSL));
}
var ls = new LineString() { Coordinates = coords, AltitudeMode = AltitudeMode.Absolute };
SharpKml.Dom.Placemark pm = new SharpKml.Dom.Placemark() { Geometry = ls, Name = "path" };
kml.AddFeature(pm);
foreach (PictureInformation picInfo in listPhotosWithInfo.Values)
{
string filename = Path.GetFileName(picInfo.Path);
string filenameWithoutExt = Path.GetFileNameWithoutExtension(picInfo.Path);
SharpKml.Dom.Timestamp tstamp = new SharpKml.Dom.Timestamp();
tstamp.When = picInfo.Time;
kml.AddFeature(
new Placemark()
{
Time = tstamp,
Visibility = true,
Name = filenameWithoutExt,
Geometry = new SharpKml.Dom.Point()
{
Coordinate = new Vector(picInfo.Lat, picInfo.Lon, picInfo.AltAMSL),
AltitudeMode = AltitudeMode.Absolute
},
Description = new Description()
{
Text = "<table><tr><td><img src=\"" + filename.ToLower() + "\" width=500 /></td></tr></table>"
},
StyleSelector = new Style()
{
Balloon = new BalloonStyle() { Text = "$[name]<br>$[description]" }
}
}
示例3: dowork
//.........这里部分代码省略.........
}
// time has past, logs are in time order
if (photodt < logdt.AddSeconds(-1))
{
lastmatchindex = a;
break;
}
//Console.Write("ph " + dt + " log " + crap + " \r");
timecoordcache[(long)(logdt.AddSeconds(-offsetseconds) - DateTime.MinValue).TotalSeconds] = new double[] {
double.Parse(arr[latpos]), double.Parse(arr[lngpos]), double.Parse(arr[altpos])
};
swlogloccsv.WriteLine("ph " + filename + " " + photodt + " log " + logdt);
if (photodt.ToString("yyyy-MM-ddTHH:mm:ss") == logdt.ToString("yyyy-MM-ddTHH:mm:ss"))
{
lastmatchindex = a;
TXT_outputlog.AppendText("MATCH Photo " + Path.GetFileNameWithoutExtension(filename) + " " + photodt + "\r\n");
matchs++;
// int fixme;
// if (matchs > 50)
// break; ;
SharpKml.Dom.Timestamp tstamp = new SharpKml.Dom.Timestamp();
tstamp.When = photodt;
kml.AddFeature(
new Placemark()
{
Time = tstamp,
Name = Path.GetFileNameWithoutExtension(filename),
Geometry = new SharpKml.Dom.Point()
{
Coordinate = new Vector(double.Parse(arr[latpos]), double.Parse(arr[lngpos]), double.Parse(arr[altpos]))
},
Description = new Description()
{
Text = "<table><tr><td><img src=\"" + Path.GetFileName(filename).ToLower() + "\" width=500 /></td></tr></table>"
},
StyleSelector = new Style()
{
Balloon = new BalloonStyle() { Text = "$[name]<br>$[description]" }
}
}
);
double lat = double.Parse(arr[latpos]);
double lng = double.Parse(arr[lngpos]);
double alpha = 0;
if (arr.Length > yawATT)
{
alpha = ((double.Parse(arr[yawATT]) / 100.0) + 180) + (double)num_camerarotation.Value;
}
else
{
alpha = double.Parse(arr[cogpos]) + (double)num_camerarotation.Value;
}
RectangleF rect = getboundingbox(lat, lng, alpha, (double)num_hfov.Value, (double)num_vfov.Value);
示例4: dowork
//.........这里部分代码省略.........
}
// time has past, logs are in time order
if (photodt < logdt.AddSeconds(-1))
{
lastmatchindex = a;
break;
}
//Console.Write("ph " + dt + " log " + crap + " \r");
timecoordcache[(long)(logdt.AddSeconds(-offsetseconds) - DateTime.MinValue).TotalSeconds] = new double[] {
double.Parse(arr[latpos]), double.Parse(arr[lngpos]), double.Parse(arr[altpos])
};
swlogloccsv.WriteLine("ph " + filename + " " + photodt + " log " + logdt);
if (photodt.ToString("yyyy-MM-ddTHH:mm:ss") == logdt.ToString("yyyy-MM-ddTHH:mm:ss"))
{
lastmatchindex = a;
TXT_outputlog.AppendText("MATCH Photo " + Path.GetFileNameWithoutExtension(filename) + " " + photodt + "\r\n");
matchs++;
// int fixme;
// if (matchs < 150 || matchs > 170)
// break; ;
SharpKml.Dom.Timestamp tstamp = new SharpKml.Dom.Timestamp();
tstamp.When = photodt;
kml.AddFeature(
new Placemark()
{
Time = tstamp,
Name = Path.GetFileNameWithoutExtension(filename),
Geometry = new SharpKml.Dom.Point()
{
Coordinate = new Vector(double.Parse(arr[latpos]), double.Parse(arr[lngpos]), double.Parse(arr[altpos]))
},
Description = new Description()
{
Text = "<table><tr><td><img src=\"" + Path.GetFileName(filename).ToLower() + "\" width=500 /></td></tr></table>"
},
StyleSelector = new Style()
{
Balloon = new BalloonStyle() { Text = "$[name]<br>$[description]" }
}
}
);
double lat = double.Parse(arr[latpos]);
double lng = double.Parse(arr[lngpos]);
double alpha = 0;
if (arr.Length > yawATT)
{
alpha = ((double.Parse(arr[yawATT]) / 100.0) + 180) + (double)num_camerarotation.Value;
}
else
{
alpha = double.Parse(arr[cogpos]) + (double)num_camerarotation.Value;
}
RectangleF rect = getboundingbox(lat, lng, alpha, (double)num_hfov.Value, (double)num_vfov.Value);
示例5: dowork
public void dowork(string logFile, string dirWithImages, float offsetseconds, bool dooffset)
{
DateTime localmin = DateTime.MaxValue;
DateTime localmax = DateTime.MinValue;
DateTime startTime = DateTime.MinValue;
//logFile = @"C:\Users\hog\Pictures\farm 1-10-2011\100SSCAM\2011-10-01 11-48 1.log";
List<string[]> list = readLog(logFile);
//dirWithImages = @"C:\Users\hog\Pictures\farm 1-10-2011\100SSCAM";
string[] files = Directory.GetFiles(dirWithImages);
Document kml = new Document();
StreamWriter sw3 = new StreamWriter(dirWithImages + Path.DirectorySeparatorChar + "location.kml");
StreamWriter sw2 = new StreamWriter(dirWithImages + Path.DirectorySeparatorChar + "location.txt");
StreamWriter sw = new StreamWriter(dirWithImages + Path.DirectorySeparatorChar + "location.tel");
sw.WriteLine("version=1");
sw.WriteLine("#longitude and latitude - in degrees");
sw.WriteLine("#name utc longitude latitude height");
int first = 0;
int matchs = 0;
foreach (string file in files)
{
if (file.ToLower().EndsWith(".jpg"))
{
DateTime dt = getPhotoTime(file);
if (startTime == DateTime.MinValue)
{
startTime = new DateTime(dt.Year, dt.Month, dt.Day, 0, 0, 0, 0, DateTimeKind.Utc).ToLocalTime();
foreach (string[] arr in list)
{
DateTime crap = startTime.AddMilliseconds(int.Parse(arr[1])).AddSeconds(offsetseconds);
if (localmin > crap)
localmin = crap;
if (localmax < crap)
localmax = crap;
}
Console.WriteLine("min " + localmin + " max " + localmax);
TXT_outputlog.AppendText("Log min " + localmin + " max " + localmax + "\r\n");
}
TXT_outputlog.AppendText("Photo " + Path.GetFileNameWithoutExtension(file) + " time " + dt + "\r\n");
foreach (string[] arr in list)
{
//Application.DoEvents();
DateTime crap = startTime.AddMilliseconds(int.Parse(arr[1])).AddSeconds(offsetseconds);
if (first == 0)
{
TXT_outputlog.AppendText("Photo " + Path.GetFileNameWithoutExtension(file) + " " + dt + " vs Log " + crap + "\r\n");
TXT_outputlog.AppendText("offset should be about " + (dt - crap).TotalSeconds + "\r\n");
if (dooffset)
return;
first++;
}
//Console.Write("ph " + dt + " log " + crap + " \r");
if (dt.Equals(crap))
{
TXT_outputlog.AppendText("MATCH Photo " + Path.GetFileNameWithoutExtension(file) + " " + dt + "\r\n");
matchs++;
kml.AddFeature(
new Placemark()
{
Name = Path.GetFileNameWithoutExtension(file),
Geometry = new SharpKml.Dom.Point()
{
Coordinate = new Vector(double.Parse(arr[lngpos]), double.Parse(arr[latpos]), double.Parse(arr[altpos]))
}
}
);
sw2.WriteLine(Path.GetFileNameWithoutExtension(file) + " " + arr[lngpos] + " " + arr[latpos] + " " + arr[altpos]);
sw.WriteLine(Path.GetFileNameWithoutExtension(file) + "\t" + crap.ToString("yyyy:MM:dd HH:mm:ss") + "\t" + arr[lngpos] + "\t" + arr[latpos] + "\t" + arr[altpos]);
sw.Flush();
sw2.Flush();
Console.WriteLine(Path.GetFileNameWithoutExtension(file) + " " + arr[lngpos] + " " + arr[latpos] + " " + arr[altpos] + " ");
break;
}
//Console.WriteLine(crap);
//.........这里部分代码省略.........
示例6: dowork
//.........这里部分代码省略.........
Application.DoEvents();
DateTime logdt = startTime.AddMilliseconds(int.Parse(arr[1])).AddSeconds(offsetseconds);
if (first == 0)
{
TXT_outputlog.AppendText("Photo " + Path.GetFileNameWithoutExtension(filename) + " " + photodt + " vs Log " + logdt + "\r\n");
TXT_outputlog.AppendText("offset should be about " + (photodt - logdt).TotalSeconds + "\r\n");
if (dooffset)
return;
first++;
}
// time has past, logs are in time order
if (photodt < logdt.AddSeconds(-1))
{
lastmatchindex = a;
break;
}
//Console.Write("ph " + dt + " log " + crap + " \r");
timecoordcache[(long)(logdt.AddSeconds(-offsetseconds) - DateTime.MinValue).TotalSeconds] = new double[] {
double.Parse(arr[latpos]), double.Parse(arr[lngpos]), double.Parse(arr[altpos])
};
sw4.WriteLine("ph " + filename + " " + photodt + " log " + logdt);
if (photodt.ToString("yyyy-MM-ddTHH:mm:ss") == logdt.ToString("yyyy-MM-ddTHH:mm:ss"))
{
lastmatchindex = a;
TXT_outputlog.AppendText("MATCH Photo " + Path.GetFileNameWithoutExtension(filename) + " " + photodt + "\r\n");
matchs++;
SharpKml.Dom.Timestamp tstamp = new SharpKml.Dom.Timestamp();
tstamp.When = photodt;
kml.AddFeature(
new Placemark()
{
Time = tstamp,
Name = Path.GetFileNameWithoutExtension(filename),
Geometry = new SharpKml.Dom.Point()
{
Coordinate = new Vector(double.Parse(arr[latpos]), double.Parse(arr[lngpos]), double.Parse(arr[altpos]))
},
Description = new Description()
{
Text = "<table><tr><td><img src=\"" + Path.GetFileName(filename).ToLower() + "\" width=500 /></td></tr></table>"
},
StyleSelector = new Style()
{
Balloon = new BalloonStyle() { Text = "$[name]<br>$[description]" }
}
}
);
photocoords[filename] = new double[] { double.Parse(arr[latpos]), double.Parse(arr[lngpos]), double.Parse(arr[altpos]), double.Parse(arr[cogpos]) };
imagetotime[filename] = (long)(logdt.AddSeconds(-offsetseconds) - DateTime.MinValue).TotalSeconds;
sw2.WriteLine(Path.GetFileNameWithoutExtension(filename) + " " + arr[lngpos] + " " + arr[latpos] + " " + arr[altpos]);
sw.WriteLine(Path.GetFileNameWithoutExtension(filename) + "\t" + logdt.ToString("yyyy:MM:dd HH:mm:ss") + "\t" + arr[lngpos] + "\t" + arr[latpos] + "\t" + arr[altpos]);
sw.Flush();
sw2.Flush();
log.InfoFormat(Path.GetFileNameWithoutExtension(filename) + " " + arr[lngpos] + " " + arr[latpos] + " " + arr[altpos] + " ");
break;
}
//Console.WriteLine(crap);
}
}
}
Serializer serializer = new Serializer();
serializer.Serialize(kml);
sw3.Write(serializer.Xml);
sw3.Close();
MainV2.instance.georefkml = serializer.Xml;
writeGPX(dirWithImages + Path.DirectorySeparatorChar + "location.gpx");
sw4.Close();
sw2.Close();
sw.Close();
TXT_outputlog.AppendText("Done " + matchs + " matchs");
}