You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
#pragma once
|
|
|
|
|
#include <QColor>
|
|
|
|
|
#include <ZxDynamic.h>
|
|
|
|
|
#include <IxGridAlign.h>
|
|
|
|
|
#include "IxSerDes.h"
|
|
|
|
|
#include "iPlotBase_global.h"
|
|
|
|
|
|
|
|
|
|
class ZxRenderItem;
|
|
|
|
|
class QPainter;
|
|
|
|
|
class ZxPaintParam;
|
|
|
|
|
|
|
|
|
|
/// 对齐网格
|
|
|
|
|
/// @note 对齐网格不能做成Layout, 因为只对当前鼠标移动的对象起作用
|
|
|
|
|
class I_PLOTBASE_EXPORT ZxSnapGrid
|
|
|
|
|
: virtual public IxDynObj
|
|
|
|
|
, virtual public IxSerDes
|
|
|
|
|
, virtual public IxGridAlign
|
|
|
|
|
{
|
|
|
|
|
ZX_DECLARE_DYNAMIC
|
|
|
|
|
public:
|
|
|
|
|
enum Style
|
|
|
|
|
{
|
|
|
|
|
dotStyle,
|
|
|
|
|
lineStyle
|
|
|
|
|
};
|
|
|
|
|
explicit ZxSnapGrid(ZxRenderItem * pOwner = 0);
|
|
|
|
|
virtual ~ZxSnapGrid();
|
|
|
|
|
virtual void onSerialize(ZxSerializer* ser);
|
|
|
|
|
virtual void onDeserialize(ZxSerializer* ser);
|
|
|
|
|
virtual QPointF calcSnapPos(const QPointF & pos) const;
|
|
|
|
|
virtual void paint(QPainter * painter, const ZxPaintParam & param);
|
|
|
|
|
|
|
|
|
|
int getVCount() const;
|
|
|
|
|
void setVCount(int n);
|
|
|
|
|
|
|
|
|
|
int getHCount() const;
|
|
|
|
|
void setHCount(int n);
|
|
|
|
|
|
|
|
|
|
void setGridWidth(float fGridWidth);
|
|
|
|
|
|
|
|
|
|
QColor getColor() const;
|
|
|
|
|
void setColor(const QColor & color);
|
|
|
|
|
|
|
|
|
|
bool isSnapEnabled() const;
|
|
|
|
|
void setSnapEnabled(bool bEnabled);
|
|
|
|
|
bool isGridVisible() const;
|
|
|
|
|
void setGridVisible(bool bVisible);
|
|
|
|
|
Style getStyle() const;
|
|
|
|
|
void setStyle(Style style);
|
|
|
|
|
private:
|
|
|
|
|
float getGridWidth() const;
|
|
|
|
|
float getGridHeight() const;
|
|
|
|
|
|
|
|
|
|
ZxRenderItem * m_pOwner;
|
|
|
|
|
float m_nVCount;
|
|
|
|
|
float m_nHCount;
|
|
|
|
|
QColor m_color;
|
|
|
|
|
bool m_bEnabled;
|
|
|
|
|
bool m_bVisible;
|
|
|
|
|
Style m_style;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|