TouchVG framework
Public 类型 | Public 成员函数 | 静态 Public 成员函数 | 所有成员列表
MgCoreView接口 参考abstract

内核视图接口 更多...

#include <mgcoreview.h>

类 MgCoreView 继承关系图:
Inheritance graph

Public 类型

enum  {
  kMgSquare, kMgClosed, kMgFixedLength, kMgFixedSize,
  kMgRotateDisnable, kMgLocked, kMgNoSnap, kMgNoAction,
  kMgNoClone, kMgHideContent, kMgNoDel, kMgCanSelLocked,
  kMgNotAddRel, kMgNotShowSnap, kMgCanAddVertex
}
 

Public 成员函数

virtual ~MgCoreView ()
 
long toHandle () const
 得到句柄,用于跨库转换 更多...
 
virtual void release ()=0
 释放引用计数,为0时销毁对象 更多...
 
virtual void addRef ()=0
 添加引用计数 更多...
 
virtual long viewDataHandle ()=0
 内部数据句柄, 可转换为 GiCoreViewData 指针 更多...
 
virtual long viewAdapterHandle ()=0
 命令视图回调适配器的句柄, 可转换为 MgView 指针 更多...
 
virtual long backDoc ()=0
 图形文档的句柄, 用 MgShapeDoc::fromHandle() 转换 更多...
 
virtual long backShapes ()=0
 当前图形列表的句柄, 用 MgShapes::fromHandle() 转换 更多...
 
virtual long acquireFrontDoc ()=0
 获取前端图形文档的句柄, 需要并发访问保护 更多...
 
virtual long acquireFrontDoc (long playh)=0
 获取指定数据源的前端图形文档的句柄 更多...
 
virtual long acquireDynamicShapes ()=0
 获取动态图形列表的句柄, 需要并发访问保护 更多...
 
virtual bool isDrawing ()=0
 返回是否正在绘制静态图形 更多...
 
virtual bool isZooming ()=0
 返回是否正在动态放缩显示 更多...
 
virtual bool isStopping ()=0
 返回是否需要停止绘图 更多...
 
virtual int stopDrawing (bool stop=true)=0
 标记需要停止绘图 更多...
 
virtual bool isUndoRecording () const =0
 是否正在Undo录制 更多...
 
virtual bool isRecording () const =0
 是否正在录屏 更多...
 
virtual bool isPlaying () const =0
 是否处于播放模式 更多...
 
virtual bool isPaused () const =0
 返回是否已暂停 更多...
 
virtual long getRecordTick (bool forUndo, long curTick)=0
 得到已开始的相对毫秒时刻 更多...
 
virtual bool isUndoLoading () const =0
 是否正加载文档 更多...
 
virtual bool canUndo () const =0
 能否撤销 更多...
 
virtual bool canRedo () const =0
 能否重做 更多...
 
virtual int getRedoIndex () const =0
 得到当前Undo位置 更多...
 
virtual int getRedoCount () const =0
 得到Undo文件数 更多...
 
long getPlayingTick (long curTick)
 得到已播放的毫秒数 更多...
 
virtual long getFrameTick ()=0
 得到当前帧的相对毫秒时刻 更多...
 
virtual int getFrameFlags ()=0
 得到当前帧的改动标志 更多...
 
virtual int getFrameIndex () const =0
 得到已播放的帧数 更多...
 
virtual bool isPressDragging ()=0
 是否按下并拖动 更多...
 
virtual bool isDrawingCommand ()=0
 当前是否为绘图命令 更多...
 
virtual bool isCommand (const char *name)=0
 当前是否为指定名称的命令 更多...
 
virtual const char * getCommand () const =0
 返回当前命令名称 更多...
 
void getCommand (MgStringCallback *c)
 得到当前命令名称 更多...
 
virtual bool setCommand (const char *name, const char *params="")=0
 启动命令 更多...
 
virtual bool switchCommand ()=0
 切换到下一命令 更多...
 
virtual bool doContextAction (int action)=0
 执行上下文动作 更多...
 
virtual void clearCachedData ()=0
 释放临时数据内存,未做线程保护 更多...
 
virtual int addShapesForTest (int n=1000)=0
 添加测试图形 更多...
 
virtual int getShapeCount ()=0
 返回后端文档的图形总数 更多...
 
virtual int getShapeCount (long doc)=0
 返回前端文档的图形总数 更多...
 
virtual int getUnlockedShapeCount (int type=0)=0
 返回未锁定的可见图形的个数 更多...
 
virtual int getVisibleShapeCount (int type=0)=0
 返回可见图形的个数 更多...
 
virtual long getChangeCount ()=0
 返回静态图形改变次数,可用于检查是否需要保存 更多...
 
virtual long getDrawCount () const =0
 返回已绘制次数,可用于录屏 更多...
 
virtual int getSelectedShapeCount ()=0
 返回选中的图形个数 更多...
 
virtual int getSelectedShapeType ()=0
 返回选中的图形的类型, MgShapeType 更多...
 
virtual int getSelectedShapeID ()=0
 返回当前选中的图形的ID,选中多个时只取第一个 更多...
 
virtual int getSelectedHandle ()=0
 返回当前线性图形中当前控制点序号 更多...
 
virtual void getSelectedShapeIDs (mgvector< int > &ids)=0
 返回当前选中的图形的ID 更多...
 
virtual void setSelectedShapeIDs (const mgvector< int > &ids)=0
 选中指定ID的图形 更多...
 
virtual void clear ()=0
 删除所有图形,包括锁定的图形 更多...
 
virtual bool loadFromFile (const char *vgfile, bool readOnly=false)=0
 从文件或JSON串中加载 更多...
 
virtual bool saveToFile (long doc, const char *vgfile, bool pretty=false)=0
 保存图形 更多...
 
bool saveToFile (const char *vgfile, bool pretty=false)
 保存图形,主线程中用 更多...
 
virtual bool loadShapes (MgStorage *s, bool readOnly=false)=0
 从数据源中加载图形 更多...
 
virtual bool saveShapes (long doc, MgStorage *s)=0
 保存图形到数据源 更多...
 
bool saveShapes (MgStorage *s)
 保存图形到数据源,主线程中用 更多...
 
virtual const char * getContent (long doc)=0
 得到图形的JSON内容,需要调用 freeContent() 更多...
 
const char * getContent ()
 得到图形内容,需调用 freeContent(),主线程中用 更多...
 
void getContent (long doc, MgStringCallback *c)
 得到图形的JSON内容,自动 freeContent() 更多...
 
void getContent (MgStringCallback *c)
 得到图形的JSON内容,主线程中用 更多...
 
virtual void freeContent ()=0
 释放 getContent() 产生的缓冲资源 更多...
 
virtual bool setContent (const char *content, bool readOnly=false)=0
 从JSON内容中加载图形 更多...
 
virtual bool zoomToInitial ()=0
 放缩到文档初始状态 更多...
 
virtual bool zoomToExtent (float margin=2)=0
 放缩显示全部内容到视图区域 更多...
 
virtual bool zoomToModel (float x, float y, float w, float h, float margin=2)=0
 放缩显示指定范围到视图区域 更多...
 
virtual bool zoomPan (float dxPixel, float dyPixel, bool adjust=true)=0
 平移显示 更多...
 
virtual GiContext & getContext (bool forChange)=0
 当前绘图属性,可用 calcPenWidth() 计算线宽 更多...
 
virtual void setContext (int mask)=0
 绘图属性改变后提交更新 更多...
 
virtual bool getShapeFlag (int sid, int bit)=0
 返回图形标志, kMgNoSnap 等位值 更多...
 
virtual bool setShapeFlag (int sid, int bit, bool on)=0
 设置图形标志 更多...
 
virtual void setContext (const GiContext &ctx, int mask, int apply)=0
 绘图属性改变后提交更新 更多...
 
virtual void setContextEditing (bool editing)=0
 设置线条属性是否正在动态修改. getContext(false)将重置为未动态修改. 更多...
 
virtual int addImageShape (const char *name, float width, float height)=0
 添加一个容纳图像的矩形图形 更多...
 
virtual int addImageShape (const char *name, float xc, float yc, float w, float h, int tag)=0
 添加一个容纳图像的矩形图形 更多...
 
virtual bool hasImageShape (long doc)=0
 返回是否有容纳图像的图形对象 更多...
 
virtual bool getImageSize (mgvector< float > &info, int sid)=0
 获取图像(MgImageShape)的原始图像宽高、显示宽高、角度(orgw, orgh, w, h, angle) 更多...
 
virtual int findShapeByImageID (long doc, const char *name)=0
 查找指定名称的图像对应的图形对象ID 更多...
 
virtual int findShapeByTag (long doc, int tag)=0
 查找指定Tag的图形对象ID 更多...
 
virtual int traverseImageShapes (long doc, MgFindImageCallback *c)=0
 遍历有容纳图像的图形对象 更多...
 
virtual bool getViewModelBox (mgvector< float > &box)=0
 返回当前视图区域的模型坐标范围,模型坐标(left, top, right, bottom) 更多...
 
virtual bool getModelBox (mgvector< float > &box)=0
 返回后端文档的模型坐标范围,模型坐标(left, top, right, bottom) 更多...
 
virtual bool getModelBox (mgvector< float > &box, int shapeId)=0
 返回后端文档中指定ID的模型坐标范围,模型坐标(left, top, right, bottom) 更多...
 
virtual bool getHandlePoint (mgvector< float > &xy, int shapeId, int index)=0
 得到指定序号的控制点的模型坐标 更多...
 
virtual bool getDisplayExtent (mgvector< float > &box)=0
 返回后端文档的图形显示范围,四个点单位坐标(left, top, right, bottom) 更多...
 
virtual bool getDisplayExtent (long doc, long gs, mgvector< float > &box)=0
 返回前端文档的图形显示范围,四个点单位坐标(left, top, right, bottom) 更多...
 
virtual bool getBoundingBox (mgvector< float > &box)=0
 返回选择包络框,四个点单位坐标(left, top, right, bottom) 更多...
 
virtual bool getBoundingBox (mgvector< float > &box, int shapeId)=0
 返回后端文档中指定ID的图形的包络框,四个点单位坐标(left, top, right, bottom) 更多...
 
virtual bool getBoundingBox (long doc, long gs, mgvector< float > &box, int shapeId)=0
 返回前端文档中指定ID的图形的包络框,四个点单位坐标(left, top, right, bottom) 更多...
 
virtual bool displayToModel (mgvector< float > &d)=0
 视图坐标转为模型坐标,可传入2或4个分量 更多...
 
virtual int importSVGPath (long shapes, int sid, const char *d)=0
 用SVG路径的d坐标序列创建或设置图形形状,成功返回图形ID(未重新显示),失败返回0 更多...
 
virtual int exportSVGPath (long shapes, int sid, char *buf, int size)=0
 输出SVG路径的d坐标序列,返回复制的长度或应分配的长度(不含结束符) 更多...
 
bool exportSVGPath2 (MgStringCallback *c, long shapes, int sid)
 输出SVG路径的d坐标序列 更多...
 

静态 Public 成员函数

static MgCoreView * fromHandle (long h)
 转为对象 更多...
 
static void releaseDoc (long doc)
 释放 acquireFrontDoc() 得到的文档句柄 更多...
 
static void releaseShapes (long shapes)
 释放 acquireDynamicShapes() 得到的图形列表句柄 更多...
 

详细描述

内核视图接口


该接口的文档由以下文件生成:

通用矢量图形框架, 版权所有 (C) 张云贵 2004-2017,BSD 开源许可证