AnsweredAssumed Answered

[C#] How to create Line of Sight?

Question asked by oyleiste on Mar 27, 2013
Latest reply on Mar 27, 2013 by oyleiste
Hello

I'm able to load a DTED Level 0 file into a RasterDataset, color it and create a IRasterLayer from it to add into axMapControl. Here is my working code:
IWorkspaceFactory wsf = new RasterWorkspaceFactoryClass(); IRasterWorkspace rasterWS = (IRasterWorkspace)wsf.OpenFromFile(@"C:\Users\ABC\Desktop\DTED_E30N40\dted\e034", 0); rasterDS = rasterWS.OpenRasterDataset("n40.dt0");  IRasterBandCollection pRasterBandCollection = (IRasterBandCollection)rasterDS; IEnumRasterBand pEnumRasterBand = pRasterBandCollection.Bands; IRasterBand pRasterBand = pEnumRasterBand.Next(); pRasterBand.ComputeStatsAndHist(); IRasterStatistics pRasterStatistics = pRasterBand.Statistics;  IRgbColor pFromColor = new RgbColorClass(); pFromColor.Red = 20; pFromColor.Green = 20; pFromColor.Blue = 220;  IRgbColor pToColor = new RgbColorClass(); pToColor.Red = 220; pToColor.Green = 20; pToColor.Blue = 20;  IAlgorithmicColorRamp pAlgorithmicColorRamp = new AlgorithmicColorRampClass(); pAlgorithmicColorRamp.FromColor = pFromColor; pAlgorithmicColorRamp.ToColor = pToColor; pAlgorithmicColorRamp.Algorithm = esriColorRampAlgorithm.esriHSVAlgorithm; pAlgorithmicColorRamp.Size = 255;  bool bOK; pAlgorithmicColorRamp.CreateRamp(out bOK);  IRasterStretchColorRampRenderer pRasterStretchColorRampRenderer = new RasterStretchColorRampRendererClass(); pRasterStretchColorRampRenderer.BandIndex = 0; pRasterStretchColorRampRenderer.LabelHigh = pRasterStatistics.Maximum.ToString(); pRasterStretchColorRampRenderer.LabelLow = pRasterStatistics.Minimum.ToString(); pRasterStretchColorRampRenderer.ColorRamp = pAlgorithmicColorRamp;  IRasterLayer rasterLayer = new RasterLayer(); rasterLayer.CreateFromDataset(rasterDS); rasterLayer.Name = "DTED Level 0 [E34-N40]"; rasterLayer.Renderer = (IRasterRenderer)pRasterStretchColorRampRenderer; axMapControl1.AddLayer(rasterLayer);

The result is this screenshot of axMapControl:[ATTACH=CONFIG]22980[/ATTACH]

Now, I want to create Line of Sight; between observer and a point. How can I do that? I have no idea unfortunately.

Thanks

Attachments

Outcomes