本文整理汇总了C#中EnvelopeClass.Project方法的典型用法代码示例。如果您正苦于以下问题:C# EnvelopeClass.Project方法的具体用法?C# EnvelopeClass.Project怎么用?C# EnvelopeClass.Project使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EnvelopeClass
的用法示例。
在下文中一共展示了EnvelopeClass.Project方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: get_TipText
/// <summary>
/// Map tip text at the specified mouse location.
/// </summary>
/// <param name="X"></param>
/// <param name="Y"></param>
/// <param name="Tolerance"></param>
/// <returns></returns>
public override string get_TipText(double X, double Y, double Tolerance)
{
IEnvelope envelope = new EnvelopeClass();
envelope.PutCoords(X - Tolerance, Y - Tolerance,X + Tolerance, Y + Tolerance);
//reproject the envelope to the datasource doordinate system
if (null != m_mapSpatialRef && m_mapSpatialRef.FactoryCode != m_layerSRFactoryCode)
{
envelope.SpatialReference = m_spatialRef;
envelope.Project(m_mapSpatialRef);
}
double xmin, ymin, xmax, ymax;
envelope.QueryCoords(out xmin, out ymin, out xmax, out ymax);
//select all the records within the given extent
string qry = "LON >= " + xmin.ToString() + " AND LON <= " + xmax.ToString() + " AND Lat >= " + ymin.ToString() + " AND LAT <= " + ymax.ToString();
DataRow[] rows = m_table.Select(qry);
if(0 == rows.Length)
return string.Empty;
DataRow r = rows[0];
string zipCode = Convert.ToString(r[1]);
string cityName = Convert.ToString(r[2]);
string temperature = Convert.ToString(r[5]);
return cityName + ", " + zipCode + ", " + temperature + "F";
}
示例2: SaveExtentAs
/// <summary>
/// Save the extent change into a new raster file.
/// </summary>
/// <param name="rasterLayer">Raster layer</param>
/// <param name="fileName">Path of the output file</param>
/// <param name="xmin">Minimum X coordinate</param>
/// <param name="ymin">Minimum Y coordinate</param>
/// <param name="pixelSize">Pixel size</param>
public static void SaveExtentAs(IRasterLayer rasterLayer, string fileName, double xmin, double ymin, double pixelSize)
{
IRasterProps rasterProps = (IRasterProps)rasterLayer.Raster;
IEnvelope extent = new EnvelopeClass();
extent.PutCoords(xmin, ymin, xmin + rasterProps.Width * pixelSize, ymin + rasterProps.Height * pixelSize);
extent.Project(rasterProps.Extent.SpatialReference);
rasterProps.Extent = extent;
ISaveAs saveAs = (ISaveAs)rasterLayer.Raster;
IWorkspaceFactory workspaceFactory = new RasterWorkspaceFactoryClass();
IWorkspace mWorkspace = workspaceFactory.OpenFromFile(System.IO.Path.GetDirectoryName(fileName), 0);
saveAs.SaveAs(System.IO.Path.GetFileName(fileName),
mWorkspace,
Raster.GetFormat(System.IO.Path.GetExtension(fileName)));
}
示例3: zoomButton_Click
private void zoomButton_Click(object sender, System.EventArgs e)
{
try
{
Conflict conflict = getSelected();
if(ext != null && conflict != null && conflict.Shape != null)
{
IEnvelope env = new EnvelopeClass();
conflict.Shape.QueryEnvelope(env);
// need to reproject here!
if (this.ext.FocusMap.SpatialReference != null)
{
env.Project(this.ext.FocusMap.SpatialReference);
env.SnapToSpatialReference();
}
((IActiveView)this.ext.FocusMap).Extent = env;
((IActiveView)this.ext.FocusMap).Refresh();
}
}
catch(Exception ee)
{
Logger.Warn(ee);
MessageBox.Show("An Unexpected Error Occured: "+ee.Message+"\n\tPlease Review the Log.",
"EXCEPTION", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
}
示例4: ConstructViewEnvAtPoint
private IEnvelope ConstructViewEnvAtPoint(IPoint pt, double size)
{
IEnvelope theEnv = new EnvelopeClass();
pt.Project(this.BCAlbersSpatialReference);
theEnv.LowerLeft = pt;
theEnv.Width = size;
theEnv.Height = size;
theEnv.Project(this.BCAlbersSpatialReference);
theEnv.CenterAt(pt);
return theEnv;
}