怎样裁剪矢量图 / 关于矢量图的一些问题
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了怎样裁剪矢量图 / 关于矢量图的一些问题相关的知识,希望对你有一定的参考价值。
回答简洁明了,我智商低!!!!3个问题,麻烦格纹高手帮帮忙谢谢
①怎样裁剪矢量图(有一张图,里面有很多小图合成起来的,怎样单独裁剪出来)
②矢量图怎样转换成位图
③矢量图作用
例图见下方↓↓↓↓↓↓↓↓
详细一点好吗?我对这些一窍不通的,包括photoshop,
裁剪工具要用哪一个,推荐一个容易使用的谢谢!!!!!!!!
2)文件→导出,即可将矢量图转换成位图
3)矢量图可以无限放大,而不会马赛克,修改起来也比较方便。 参考技术A 用裁剪工具一个一个的裁剪,其实PS就是一个位图软件你把他储存为JPG格式时就已经是位图了。 参考技术B 主要看你是用的什么软件,若是CDR的话,直接把你要的那块用选择工具选出来就行了,其它的再删掉。转位图要导出去,快捷键:Ctrl+E 参考技术C 1.矢量图用软件(AI或别的软件)打开后右击图片点取消编组,就可以复制或者移动你想要的部分了。
2.貌似存成JPG就是位图
3.放大也会一样清晰
PIE SDK的矢量裁剪矢量文件的Algo
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PIE.SystemAlgo;
using PIE.Carto;
using System.IO;
using PIE.DataSource;
using PIE.Geometry;
namespace Algo
{
/// <summary>
/// 用矢量文件裁剪矢量文件
/// </summary>
public class VectorClipAlgo:ISystemAlgo,ISystemAlgoEvents
{
private AlgoParms m_params;
//
// 摘要:
// 描述
public string Description { get; set; }
//
// 摘要:
// 名称
public string Name { get; set; }
public object Params
{
get
{
return m_params;
}
set
{
if (value ==null)
{
return;
}
m_params = (AlgoParms)value;
}
}
public VectorClipAlgo()
{
}
public event OnProgressChangedEventHandler OnProgressChanged;
public event OnExecuteCompletedEventHandler OnExecuteCompleted;
public void GetErrorInfo(ref int errCode, ref string errMsg)
{
throw new NotImplementedException();
}
public void SetErrorInfo(int errCode, string errMsg)
{
throw new NotImplementedException();
}
public bool Execute()
{
try
{
if (!File.Exists(m_params.InputFilePath)|| !File.Exists(m_params.ShpFilePath))//如果不存在,或者不是shp文件
{
return false;
}
ILayer layer = LayerFactory.CreateDefaultLayer(m_params.InputFilePath);
ILayer flayer = LayerFactory.CreateDefaultLayer(m_params.ShpFilePath);
if (layer == null|| flayer == null)
{
return false;
}
IFeatureDataset fdataset = (layer as IFeatureLayer).FeatureClass.GetFeatureDataset();
if (m_params.Type==0)
{
ClipByShpIn(fdataset, flayer);
}
else//type==1外切
{
ClipByShpOut(fdataset, flayer);
}
fdataset.Save();
fdataset.Copy(m_params.OutputFilePath);
((IDisposable)fdataset).Dispose();
fdataset = null;
return false;
}
catch (Exception)
{
return false;
}
}
/// <summary>
/// 矢量裁切矢量文件(内切)
/// </summary>
private void ClipByShpIn(IFeatureDataset fdataset, ILayer flayer)
{
try
{
Geometry cngeo = (flayer as IFeatureLayer).FeatureClass.GetFeature(0).Geometry as Geometry;
IFeatureClass fclass = new FeatureClass(fdataset);
long fcount = fclass.GetFeatureCount();
List<IGeometry> listgeos = new List<IGeometry>();
ISpatialReference spGLL = SpatialReferenceFactory.CreateSpatialReference(4326);
for (int i = 0; i < fcount; i++)
{
IFeature feature = fclass.GetFeature(i);
if (feature == null)
{
continue;
}
IGeometry geos = feature.Geometry as Geometry;
geos.SpatialReference = spGLL;
if (geos.GetGeometryType() == GeometryType.GeometryMultiPolygon)
{
for (int h = 0; h < (geos as IGeometryCollection).GetGeometryCount(); h++)
{
IGeometry geo = (geos as MultiPolygon).GetGeometry(h);
geo.SpatialReference = spGLL;
IGeometry ingeo = cngeo.Intersection(geo);
bool flag = cngeo.Intersects(geo);
if (ingeo != null)
{
listgeos.Add(ingeo);
}
}
}
else
{
IGeometry ingeo = (cngeo as Geometry).Intersection(geos);
if (ingeo != null)
{
listgeos.Add(ingeo);
}
}
fdataset.DeleteFeature(i);
}
for (int i = 0; i < listgeos.Count; i++)
{
IFeature feature = fdataset.CreateNewFeature();
feature.Geometry = listgeos[i];
fdataset.AddFeature(feature);
}
}
catch (Exception)
{
}
}
/// <summary>
/// 矢量裁切矢量文件(外切)
/// </summary>
private void ClipByShpOut(IFeatureDataset fdataset, ILayer flayer)
{
try
{
Geometry cngeo = (flayer as IFeatureLayer).FeatureClass.GetFeature(0).Geometry as Geometry;
IFeatureClass fclass = new FeatureClass(fdataset);
List<IGeometry> listgeos = new List<IGeometry>();
List<int> ss = new List<int>();
long fcount = fclass.GetFeatureCount();
ISpatialReference spGLL = SpatialReferenceFactory.CreateSpatialReference(4326);
for (int i = 0; i < fcount; i++)
{
IFeature feature = fclass.GetFeature(i);
if (feature == null)
{
continue;
}
IGeometry geo = feature.Geometry as Geometry;
geo.SpatialReference = spGLL;
if (!(geo as Geometry).Within(cngeo))//如果不在内部
{
IGeometry ingeo = cngeo.Intersection(geo);
if (ingeo == null)
{
listgeos.Add(geo);
fdataset.DeleteFeature(i);
}
else
{
IGeometry outgeo = (geo as Geometry).Difference(ingeo as Geometry);
listgeos.Add(outgeo);
fdataset.DeleteFeature(i);
}
}
else
{
fdataset.DeleteFeature(i);
}
}
for (int i = 0; i < listgeos.Count; i++)
{
IFeature feature = fdataset.CreateNewFeature();
feature.Geometry = listgeos[i];
fdataset.AddFeature(feature);
}
listgeos.Clear();
}
catch (Exception)
{
}
}
public void RaiseExecuteCompletedEvent()
{
throw new NotImplementedException();
}
}
public class AlgoParms
{
/// <summary>
/// 输入的shp路径
/// </summary>
public string InputFilePath { get; set; }
/// <summary>
/// 0裁剪shp内部,1裁剪shp外部
/// </summary>
public int Type { get; set; }
/// <summary>
/// 需要输入的shp文件路径
/// </summary>
public string ShpFilePath { get; set; }
/// <summary>
/// 需要输出的shp文件路径
/// </summary>
public string OutputFilePath { get; set; }
/// <summary>
/// 功能名称
/// </summary>
public string FuncName { get; set; }
}
}
以上是关于怎样裁剪矢量图 / 关于矢量图的一些问题的主要内容,如果未能解决你的问题,请参考以下文章