///////////////////////////////////////////////////////////////////////////////
|
// Copyright (C) 2002-2015, Open Design Alliance (the "Alliance").
|
// All rights reserved.
|
//
|
// This software and its documentation and related materials are owned by
|
// the Alliance. The software may only be incorporated into application
|
// programs owned by members of the Alliance, subject to a signed
|
// Membership Agreement and Supplemental Software License Agreement with the
|
// Alliance. The structure and organization of this software are the valuable
|
// trade secrets of the Alliance and its suppliers. The software is also
|
// protected by copyright law and international treaty provisions. Application
|
// programs incorporating this software must include the following statement
|
// with their copyright notices:
|
//
|
// This application incorporates Teigha(R) software pursuant to a license
|
// agreement with Open Design Alliance.
|
// Teigha(R) Copyright (C) 2002-2015 by Open Design Alliance.
|
// All rights reserved.
|
//
|
// By use of this software, its documentation or related materials, you
|
// acknowledge and accept the above terms.
|
///////////////////////////////////////////////////////////////////////////////
|
|
// stdafx.cpp : source file that includes just the standard includes
|
// OpenCAD.pch will be the pre-compiled header
|
// stdafx.obj will contain the pre-compiled type information
|
|
#include "stdafx.h"
|
|
// #ifdef _TOOLKIT_IN_DLL_
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
// Copyright (C) 2002-2015, Open Design Alliance (the "Alliance").
|
// All rights reserved.
|
//
|
// This software and its documentation and related materials are owned by
|
// the Alliance. The software may only be incorporated into application
|
// programs owned by members of the Alliance, subject to a signed
|
// Membership Agreement and Supplemental Software License Agreement with the
|
// Alliance. The structure and organization of this software are the valuable
|
// trade secrets of the Alliance and its suppliers. The software is also
|
// protected by copyright law and international treaty provisions. Application
|
// programs incorporating this software must include the following statement
|
// with their copyright notices:
|
//
|
// This application incorporates Teigha(R) software pursuant to a license
|
// agreement with Open Design Alliance.
|
// Teigha(R) Copyright (C) 2002-2015 by Open Design Alliance.
|
// All rights reserved.
|
//
|
// By use of this software, its documentation or related materials, you
|
// acknowledge and accept the above terms.
|
///////////////////////////////////////////////////////////////////////////////
|
|
// stdafx.cpp : source file that includes just the standard includes
|
// OpenCAD.pch will be the pre-compiled header
|
// stdafx.obj will contain the pre-compiled type information
|
|
|
#include <map>
|
#include <vector>
|
|
std::map<int, OdDbObjectId> _mapId2Object;
|
std::map<int, OdDbObjectId> _mapId2ObjectText;
|
|
// #endif
|
int addHatches(const OdDbObjectId& btrId, const OdString& textName, float w,
|
double x, double y, const OdDbObjectId& layerId,
|
const OdDbObjectId& shxStyleId, const OdDbObjectId& ttfStyleId,
|
bool bValidText) {
|
/**********************************************************************/
|
/* Open the BlockTableRecord */
|
/**********************************************************************/
|
OdDbBlockTableRecordPtr bBTR = btrId.safeOpenObject(OdDb::kForWrite);
|
|
OdDbDatabase* pDb = btrId.database();
|
|
OdGePoint3d rightupper = pDb->getEXTMAX();
|
OdGePoint3d leftBottom = pDb->getEXTMIN();
|
/**********************************************************************/
|
/* Get the Upper-left corner of the box and its size */
|
/**********************************************************************/
|
OdGePoint3d point;
|
point.x = x;
|
point.y = y;
|
// double h = m_EntityBoxes.getHeight();
|
//double w = 3000;
|
double delta = w;
|
|
/**********************************************************************/
|
/* Create a rectangular Hatch with a circular hole */
|
/**********************************************************************/
|
OdDbHatchPtr pHatch = OdDbHatch::createObject();
|
pHatch->setDatabaseDefaults(pDb);
|
OdDbObjectId whiteHatchId = bBTR->appendOdDbEntity(pHatch);
|
|
/**********************************************************************/
|
/* Set some properties */
|
/**********************************************************************/
|
pHatch->setAssociative(false);
|
pHatch->setPattern(OdDbHatch::kPreDefined, OD_T("SOLID"));
|
pHatch->setHatchStyle(OdDbHatch::kNormal);
|
|
OdCmColor col1;
|
if (!bValidText) {
|
col1.setRGB(240, 104, 37);
|
}
|
else {
|
col1.setRGB(37, 214, 240);
|
}
|
// col1.setRGB(255, 0, 0); //±ê×¢ÑÕÉ«
|
pHatch->setColor(col1);
|
OdCmTransparency transparency;
|
transparency.setAlphaPercent(0.7);
|
pHatch->setTransparency(transparency);
|
|
/**********************************************************************/
|
/* Define the outer loop with an OdGePolyline2d */
|
/**********************************************************************/
|
OdGePoint2dArray vertexPts;
|
OdGeDoubleArray vertexBulges;
|
|
double zy = 0.8;
|
double zx = 0.2;
|
double zw = 1.5;
|
double zh = 1;
|
vertexPts.resize(7);
|
vertexPts[0].set(point.x, point.y);
|
vertexPts[1].set(point.x + delta * zx, point.y * zh + delta * zy);
|
vertexPts[2].set(point.x + delta * zw, point.y * zh + delta * zy);
|
vertexPts[3].set(point.x + delta * zw, point.y * zh + delta * zy + delta);
|
vertexPts[4].set(point.x - delta * zw, point.y * zh + delta * zy + delta);
|
vertexPts[5].set(point.x - delta * zw, point.y * zh + delta * zy);
|
vertexPts[6].set(point.x - delta * zx, point.y * zh + delta * zy);
|
|
pHatch->appendLoop(OdDbHatch::kExternal | OdDbHatch::kPolyline, vertexPts,
|
vertexBulges);
|
|
std::vector < OdDbObjectId > vecObjectId;
|
|
vecObjectId.push_back(pHatch->objectId());
|
|
OdDbHandle id1 = pHatch->handle();
|
OdUInt64 nId = id1;
|
_mapId2Object[nId] = pHatch->objectId();
|
|
/**********************************************************************/
|
/* Add a label */
|
/**********************************************************************/
|
OdGePoint3d position;
|
position = point;
|
point.y += zy * w + w * 0.5;
|
point.z = 10;
|
OdDbObjectId id = addTextEnt(bBTR, point, point, textName, 0.4 * w,
|
OdDb::kTextMid, OdDb::kTextVertMid, layerId, shxStyleId);
|
|
_mapId2ObjectText[nId] = id;
|
|
return nId;
|
}
|
|
/************************************************************************/
|
/* Add an Image to the specified BlockTableRecord */
|
/************************************************************************/
|
int addImage(OdDbDatabasePtr pDb, const OdString& sImagePath, double xPos, double yPos, double width, double height, const OdString& textName, const OdDbObjectId& layerId, const OdDbObjectId& shxStyleId)
|
{
|
OdDbBlockTableRecordPtr pRecord = pDb->getActiveLayoutBTRId().safeOpenObject(OdDb::kForWrite);
|
OdDbObjectId imageDictId = OdDbRasterImageDef::createImageDictionary(pRecord->database());
|
OdDbDictionaryPtr pImageDict = imageDictId.safeOpenObject(OdDb::kForWrite);
|
// Create image definition
|
OdDbObjectId defId;
|
OdDbRasterImageDefPtr pDef = OdDbRasterImageDef::createObject();
|
pDef->setSourceFileName(sImagePath);
|
|
char s[MAX_PATH];
|
// int i = _mapId2Object.size();
|
int i = rand();
|
sprintf(s, "pic__%d", i);
|
defId = pImageDict->setAt(s, pDef);
|
// Try to load raster image to found correct dimensions inside TD
|
OdDbRasterImageDefPtr pDefLoad = OdDbRasterImageDef::cast(defId.openObject(OdDb::kForWrite));
|
OdResult result = pDefLoad->load(false);
|
OdGeVector2d size = pDefLoad->size();
|
if(width==0){
|
width = size.x;
|
height = size.y;
|
}
|
// Create and attach raster image reference
|
OdDbRasterImagePtr pRef = OdDbRasterImage::createObject();
|
pRef->setDatabaseDefaults(pDb);
|
pRecord->appendOdDbEntity(pRef);
|
|
pRef->setImageDefId(defId);
|
OdGePoint3d origin;
|
OdGeVector3d u, v;
|
|
|
origin.x = xPos-width/2;
|
origin.y = yPos;
|
origin.z = 0;
|
|
|
u.set(width, 0, 0);
|
v.set(0, height, 0);
|
|
pRef->setOrientation(origin, u, v);
|
pRef->setDisplayOpt(OdDbRasterImage::kShow, true);
|
pRef->setDisplayOpt(OdDbRasterImage::kTransparent, true);
|
pRef->setDisplayOpt(OdDbRasterImage::kClip, false);
|
OdCmTransparency transparency;
|
if (textName.getLength()) {
|
transparency.setAlphaPercent(0.7);
|
} else {
|
transparency.setAlphaPercent(1.0);
|
}
|
pRef->setTransparency(transparency);
|
|
//¹Ø±ÕͼƬframe
|
OdDbRasterVariablesPtr pRVars = OdDbRasterVariables::openRasterVariables(pRecord->database(), OdDb::kForWrite);
|
pRVars->setImageFrame(OdDbRasterVariables::kImageFrameOff);
|
|
|
OdDbHandle id1 = pRef->handle();
|
OdUInt64 nId = id1;
|
_mapId2Object[nId] = pRef->objectId();
|
|
|
/**********************************************************************/
|
/* Add a label */
|
/**********************************************************************/
|
OdGePoint3d position;
|
position = origin;
|
position.x += width / 2;
|
position.y += height / 1.5;
|
position.z = 10;
|
OdDbObjectId id = addTextEnt(pRecord, position, position, textName, 0.5 * height,
|
OdDb::kTextMid, OdDb::kTextVertMid, layerId, shxStyleId);
|
|
_mapId2ObjectText[nId] = id;
|
|
return nId;
|
}
|
|
OdDbObjectId addLayer(OdDbDatabase* pDb, const OdString& name,
|
const OdCmColor color, const OdString& linetype) {
|
OdDbLayerTablePtr pLayersRead = pDb->getLayerTableId().safeOpenObject(
|
OdDb::kForRead);
|
OdDbSymbolTableIteratorPtr pEntIter = pLayersRead->newIterator();
|
/********************************************************************/
|
for (; !pEntIter->done(); pEntIter->step()) {
|
/********************************************************************/
|
/* Dump the Entity */
|
/********************************************************************/
|
OdDbLayerTableRecordPtr pEntity = pEntIter->getRecord();
|
if (pEntity->getName() == name)
|
return pEntity->objectId();
|
}
|
|
/**********************************************************************/
|
/* Open the layer table */
|
/**********************************************************************/
|
OdDbLayerTablePtr pLayers = pDb->getLayerTableId().safeOpenObject(
|
OdDb::kForWrite);
|
|
/**********************************************************************/
|
/* Create a layer table record */
|
/**********************************************************************/
|
OdDbLayerTableRecordPtr pLayer = OdDbLayerTableRecord::createObject();
|
|
/**********************************************************************/
|
/* Layer must have a name before adding it to the table. */
|
/**********************************************************************/
|
pLayer->setName(name);
|
|
/**********************************************************************/
|
/* Set the Color. */
|
/**********************************************************************/
|
// pLayer->setColorIndex(color);
|
pLayer->setColor(color);
|
|
/**********************************************************************/
|
/* Set the Linetype. */
|
/**********************************************************************/
|
OdDbLinetypeTablePtr pLinetypes = pDb->getLinetypeTableId().safeOpenObject(
|
OdDb::kForRead);
|
OdDbObjectId linetypeId = pLinetypes->getAt(linetype);
|
pLayer->setLinetypeObjectId(linetypeId);
|
|
/**********************************************************************/
|
/* Add the record to the table. */
|
/**********************************************************************/
|
OdDbObjectId layerId = pLayers->add(pLayer);
|
|
return layerId;
|
}
|
|
/************************************************************************/
|
/* Add a Text Style to the specified database */
|
/* */
|
/* The symbol table and symbol table record are implicitly closed when */
|
/* this function returns. */
|
/************************************************************************/
|
OdDbObjectId addStyle(OdDbDatabase* pDb, const OdString& txt, const OdString& hztxt, const OdString& styleName,
|
double textSize, double xScale, double priorSize, double obliquing,
|
const OdString& fileName, bool isShapeFile, const OdString& ttFaceName,
|
bool bold, bool italic, int charset, int pitchAndFamily)
|
{
|
OdDbTextStyleTablePtr pLayersRead =
|
pDb->getTextStyleTableId().safeOpenObject(OdDb::kForRead);
|
OdDbSymbolTableIteratorPtr pEntIter = pLayersRead->newIterator();
|
/********************************************************************/
|
for (; !pEntIter->done(); pEntIter->step()) {
|
/********************************************************************/
|
/* Dump the Entity */
|
/********************************************************************/
|
OdDbTextStyleTableRecordPtr pEntity = pEntIter->getRecord();
|
if (pEntity->getName() == styleName)
|
return pEntity->objectId();
|
}
|
|
OdDbObjectId styleId;
|
|
OdDbTextStyleTablePtr pStyles = pDb->getTextStyleTableId().safeOpenObject(
|
OdDb::kForWrite);
|
OdDbTextStyleTableRecordPtr pStyle =
|
OdDbTextStyleTableRecord::createObject();
|
|
// Name must be set before a table object is added to a table. The
|
// isShapeFile flag must also be set (if true) before adding the object
|
// to the database.
|
pStyle->setName(styleName);
|
pStyle->setIsShapeFile(false);
|
|
pStyle->setFileName(txt);
|
pStyle->setBigFontFileName(hztxt);
|
|
// Add the object to the table.
|
styleId = pStyles->add(pStyle);
|
|
// Set the remaining properties.
|
pStyle->setTextSize(textSize);
|
pStyle->setXScale(xScale);
|
pStyle->setPriorSize(priorSize);
|
pStyle->setObliquingAngle(obliquing);
|
// pStyle->setFileName(fileName);
|
if (isShapeFile) {
|
pStyle->setPriorSize(22.45);
|
}
|
if (!ttFaceName.isEmpty()) {
|
pStyle->setFont(ttFaceName, bold, italic, charset, pitchAndFamily);
|
}
|
|
return styleId;
|
}
|
|
std::vector<OdDbObjectId> _vecObjectId;
|
|
void ZoomTag(OdDbDatabasePtr m_pDatabase, double revZoomScale) {
|
OdDbBlockTableRecordPtr pBlockTableRecord =
|
m_pDatabase->getModelSpaceId().safeOpenObject(OdDb::kForRead);
|
OdGePoint3d Start, End;
|
std::map<int, OdDbObjectId>::iterator iter = _mapId2Object.begin();
|
while (iter != _mapId2Object.end()) {
|
int key = iter->first;
|
OdDbObjectId val = iter->second;
|
OdDbObjectPtr oid = val.openObject(OdDb::kForWrite, false);
|
|
OdDbHatchPtr hatch = OdDbHatch::cast(oid);
|
if (!hatch.isNull()) {
|
OdGePoint2dArray vertices;
|
OdGeDoubleArray bulges;
|
hatch->getLoopAt(0, vertices, bulges);
|
// writeLine(indent++, OD_T("Edges"));
|
int nCnt = vertices.size();
|
OdGePoint2d origin = vertices[0];
|
Start.set(origin.x, origin.y, 0);
|
OdGeMatrix3d tm;
|
tm.setToScaling(revZoomScale, Start);
|
hatch->transformBy(tm);
|
|
std::map<int, OdDbObjectId>::iterator iter1 = _mapId2ObjectText.find(
|
key);
|
if (iter1 != _mapId2ObjectText.end()) {
|
OdDbObjectId val = iter1->second;
|
OdDbObjectPtr oid = val.openObject(OdDb::kForWrite, false);
|
|
OdDbTextPtr text = OdDbText::cast(oid);
|
if (!text.isNull()) {
|
OdGePoint3d pos = text->position();
|
|
OdGeMatrix3d tm;
|
tm.setToScaling(revZoomScale, Start);
|
text->transformBy(tm);
|
}
|
}
|
}
|
|
|
|
OdDbRasterImagePtr image = OdDbRasterImage::cast(oid);
|
if (!image.isNull()) {
|
OdGePoint3d origin;
|
OdGeVector3d u, v;
|
image->getOrientation(origin, u, v);
|
origin.x += u[0] / 2;
|
OdGeMatrix3d tm;
|
tm.setToScaling(revZoomScale, origin);
|
image->transformBy(tm);
|
|
std::map<int, OdDbObjectId>::iterator iter1 = _mapId2ObjectText.find(
|
key);
|
if (iter1 != _mapId2ObjectText.end()) {
|
OdDbObjectId val = iter1->second;
|
OdDbObjectPtr oid = val.openObject(OdDb::kForWrite, false);
|
|
OdDbTextPtr text = OdDbText::cast(oid);
|
if (!text.isNull()) {
|
OdGePoint3d pos = text->position();
|
|
OdGeMatrix3d tm;
|
tm.setToScaling(revZoomScale, origin);
|
text->transformBy(tm);
|
}
|
}
|
}
|
|
iter++;
|
}
|
}
|
|
/************************************************************************/
|
/* Add a text entity with the specified attributes to the specified */
|
/* BlockTableRecord */
|
/************************************************************************/
|
OdDbObjectId addTextEnt(OdDbBlockTableRecord* bBTR, const OdGePoint3d& position,
|
const OdGePoint3d& ap, const OdString& str, double height,
|
OdDb::TextHorzMode hMode, OdDb::TextVertMode vMode,
|
const OdDbObjectId& layerId, const OdDbObjectId& styleId,
|
OdDbGroup* pGroup) {
|
/**********************************************************************/
|
/* Create the text object */
|
/**********************************************************************/
|
OdDbTextPtr pText = OdDbText::createObject();
|
pText->setDatabaseDefaults(bBTR->database());
|
OdDbObjectId textId = bBTR->appendOdDbEntity(pText);
|
|
// Make the text annotative
|
OdDbAnnotativeObjectPEPtr(pText)->setAnnotative(pText, true);
|
|
/**********************************************************************/
|
/* Add the text to the specified group */
|
/**********************************************************************/
|
if (pGroup) {
|
pGroup->append(textId);
|
}
|
|
/**********************************************************************/
|
/* Set some properties */
|
/**********************************************************************/
|
pText->setPosition(position);
|
pText->setAlignmentPoint(ap);
|
pText->setHeight(height);
|
pText->setWidthFactor(1.0);
|
pText->setTextString(str);
|
pText->setHorizontalMode(hMode);
|
pText->setVerticalMode(vMode);
|
|
/**********************************************************************/
|
/* Set the text to the specified style */
|
/**********************************************************************/
|
if (!styleId.isNull()) {
|
pText->setTextStyle(styleId);
|
}
|
/**********************************************************************/
|
/* Set the text to the specified layer */
|
/**********************************************************************/
|
if (!layerId.isNull()) {
|
pText->setLayer(layerId, false);
|
}
|
|
return textId;
|
}
|
|
void ScreenToWorld(OdGsViewPtr pDevice, float x, float y, float out[]) {
|
OdGsViewPtr pView = pDevice;
|
OdGePoint3d WCSPoint(x, y, 0.0);
|
|
OdGeMatrix3d screenMatrix = pView->screenMatrix();
|
OdGeMatrix3d projectionMatrix = pView->projectionMatrix();
|
|
WCSPoint.transformBy(
|
(pView->screenMatrix() * pView->projectionMatrix()).inverse());
|
WCSPoint.z = 0.0;
|
WCSPoint.transformBy(OdAbstractViewPEPtr(pView)->eyeToWorld(pView));
|
|
out[0] = WCSPoint.x;
|
out[1] = WCSPoint.y;
|
out[2] = WCSPoint.z;
|
}
|
|
void WorldToScreen(OdGsViewPtr pDevice, float x, float y, float z,
|
float out[]) {
|
OdGsViewPtr pView = pDevice;
|
OdGePoint3d WCSPoint(x, y, z);
|
OdGeMatrix3d xWorldToScr = pView->worldToDeviceMatrix();
|
OdGePoint3d pt = xWorldToScr * WCSPoint;
|
|
out[0] = pt.x;
|
out[1] = pt.y;
|
}
|
|
int AddShape(OdDbDatabase* pDb, const OdString& txt, const OdString& hztxt, float x, float y, float fSize, const OdString& sImagePath, const OdString& sLableText, bool bValidText)
|
{
|
OdCmColor clr;
|
OdString name;
|
// clr.setRGB(255, 255, 255);
|
if (bValidText){
|
clr.setRGB(255, 255, 255);
|
name = OD_T("JKYTextLayer");
|
}
|
else{
|
clr.setRGB(0, 255, 0);
|
name = OD_T("JKYTextLayer1");
|
}
|
|
OdDbObjectId odaLayerId = addLayer(pDb, name, clr, OD_T("CONTINUOUS"));
|
|
OdDbObjectId shxTextStyleId = addStyle(pDb, txt, hztxt, OD_T("OdaShxStyle"), 0.0, 1.0,
|
0.2, 0.0, OD_T("txt"));
|
|
//int nId = addHatches(pDb->getModelSpaceId(), sLableText, 2000, x, y, odaLayerId, shxTextStyleId, shxTextStyleId, bValidText);
|
|
int nId = addImage(pDb, sImagePath, x, y, fSize, fSize*0.3, sLableText, odaLayerId, shxTextStyleId);
|
return nId;
|
}
|
|
void DeleteShape(OdDbDatabasePtr m_pDatabase, int nID) {
|
OdDbBlockTableRecordPtr pBlockTableRecord =
|
m_pDatabase->getModelSpaceId().safeOpenObject(OdDb::kForRead);
|
|
if (nID > 0) {
|
std::map<int, OdDbObjectId>::iterator iter = _mapId2Object.find(nID);
|
if (iter != _mapId2Object.end()) {
|
OdDbObjectId id = iter->second;
|
OdDbObjectPtr oid = id.openObject(OdDb::kForWrite, false);
|
oid->erase();
|
|
_mapId2Object.erase(iter);
|
}
|
|
iter = _mapId2ObjectText.find(nID);
|
if (iter != _mapId2ObjectText.end()) {
|
OdDbObjectId id = iter->second;
|
OdDbObjectPtr oid = id.openObject(OdDb::kForWrite, false);
|
oid->erase();
|
|
_mapId2ObjectText.erase(iter);
|
}
|
}
|
else {
|
std::map<int, OdDbObjectId>::iterator iter = _mapId2Object.begin();
|
while (iter != _mapId2Object.end()) {
|
DeleteShape(m_pDatabase, iter->first);
|
iter++;
|
}
|
ClearData();
|
}
|
}
|
|
int PickShapeByCursor(OdGsViewPtr pDevice, OdDbDatabasePtr m_pDatabase, float x,
|
float y) {
|
int nRet = 0;
|
OdDbBlockTableRecordPtr pBlockTableRecord =
|
m_pDatabase->getModelSpaceId().safeOpenObject(OdDb::kForRead);
|
float out[3];
|
ScreenToWorld(pDevice, x, y, out);
|
OdGePoint3d Start, End;
|
std::map<int, OdDbObjectId>::iterator iter = _mapId2Object.begin();
|
while (iter != _mapId2Object.end()) {
|
int key = iter->first;
|
OdDbObjectId val = iter->second;
|
OdDbObjectPtr oid = val.openObject(OdDb::kForRead, false);
|
|
OdDbHatchPtr hatch = OdDbHatch::cast(oid);
|
if (!hatch.isNull()) {
|
OdGePoint2dArray vertices;
|
OdGeDoubleArray bulges;
|
hatch->getLoopAt(0, vertices, bulges);
|
// writeLine(indent++, OD_T("Edges"));
|
int nCnt = vertices.size();
|
|
float xmin = 0, ymin = 0, xmax = 0, ymax = 0;
|
for (int i = 0; i < nCnt; i++) {
|
if (i == 0) {
|
xmin = vertices[i].x;
|
ymin = vertices[i].y;
|
xmax = vertices[i].x;
|
ymax = vertices[i].y;
|
}
|
else {
|
if (xmin > vertices[i].x)
|
xmin = vertices[i].x;
|
if (ymin > vertices[i].y)
|
ymin = vertices[i].y;
|
if (xmax < vertices[i].x)
|
xmax = vertices[i].x;
|
if (ymax < vertices[i].y)
|
ymax = vertices[i].y;
|
}
|
}
|
|
if (out[0] > xmin && out[0] < xmax && out[1] > ymin
|
&& out[1] < ymax) {
|
nRet = key;
|
break;
|
}
|
}
|
|
OdDbRasterImagePtr image = OdDbRasterImage::cast(oid);
|
if (!image.isNull())
|
{
|
float xmin = 0, ymin = 0, xmax = 0, ymax = 0;
|
OdGePoint3d origin;
|
OdGeVector3d u, v;
|
image->getOrientation(origin, u, v);
|
|
xmin = origin.x;
|
ymin = origin.y;
|
xmax = xmin + u[0];
|
ymax = ymin + v[1];
|
if (out[0] > xmin && out[0] < xmax && out[1] > ymin
|
&& out[1] < ymax) {
|
nRet = key;
|
break;
|
}
|
}
|
|
iter++;
|
}
|
|
return nRet;
|
}
|
|
void ClearData() {
|
_mapId2Object.clear();
|
_mapId2ObjectText.clear();
|
}
|
|
|
// #endif
|