|
|
@ -1,9 +1,11 @@
|
|
|
|
#include "geofeatureoperator.h"
|
|
|
|
#include "geofeatureoperator.h"
|
|
|
|
#include "Engine/UGDataSource.h"
|
|
|
|
#include "Engine/UGDataSource.h"
|
|
|
|
#include "Geometry/UGGeoLine.h"
|
|
|
|
#include "Geometry/UGGeoLine.h"
|
|
|
|
|
|
|
|
#include "Geometry3D/UGGeoPoint3D.h"
|
|
|
|
#include "Map/UGMap.h"
|
|
|
|
#include "Map/UGMap.h"
|
|
|
|
#include "MapEditor/UGMapEditorWnd.h"
|
|
|
|
#include "MapEditor/UGMapEditorWnd.h"
|
|
|
|
#include "qdebug.h"
|
|
|
|
#include "qdebug.h"
|
|
|
|
|
|
|
|
#include "qvector3d.h"
|
|
|
|
#include "routeglobalvariant.h"
|
|
|
|
#include "routeglobalvariant.h"
|
|
|
|
#include "translator.h"
|
|
|
|
#include "translator.h"
|
|
|
|
#include "layeroperator.h"
|
|
|
|
#include "layeroperator.h"
|
|
|
@ -202,7 +204,80 @@ int GeoFeatureOperator::importFeatureAttribute(UGDatasetVector *dv, UGGeometry*
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//获取几何对象所有节点坐标
|
|
|
|
/*@获取几何对象所有节点坐标
|
|
|
|
|
|
|
|
*@points 使用三维坐标存储航点
|
|
|
|
|
|
|
|
*@altitude 用于兼容二维点,默认为0
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
void GeoFeatureOperator::getNodePoints(UGGeometry* pGeometry, QVector<QVector3D>&points,double altitude)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
QVector3D point;
|
|
|
|
|
|
|
|
int type = pGeometry->GetType();
|
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
|
|
|
|
case UGGeometry::GeoLine:
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
UGGeoLine* line = (UGGeoLine*)pGeometry;
|
|
|
|
|
|
|
|
const UGPoint2D* p = line->GetPoints(); //节点指针
|
|
|
|
|
|
|
|
int nodeNum = line->GetPointCount(); //节点数
|
|
|
|
|
|
|
|
if (line->GetStartNode() == line->GetEndNode())
|
|
|
|
|
|
|
|
{//闭合航线,减去末尾重合航点
|
|
|
|
|
|
|
|
nodeNum--;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for(int i = 0;i<nodeNum;i++) //遍历一个要素所有节点
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
point.setX(p->x);
|
|
|
|
|
|
|
|
point.setY(p->y);
|
|
|
|
|
|
|
|
point.setZ(altitude);
|
|
|
|
|
|
|
|
points.append(point);
|
|
|
|
|
|
|
|
p++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
line = NULL;
|
|
|
|
|
|
|
|
p = NULL;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
case UGGeometry::GeoRegion:
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
UGGeoRegion* polygon = (UGGeoRegion*)pGeometry;
|
|
|
|
|
|
|
|
const UGPoint2D* p = polygon->GetPoints(); //节点指针
|
|
|
|
|
|
|
|
int nodeNum = polygon->GetPointCount()-1; //节点数
|
|
|
|
|
|
|
|
for(int i = 0;i<nodeNum;i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
point.setX(p->x);
|
|
|
|
|
|
|
|
point.setY(p->y);
|
|
|
|
|
|
|
|
point.setZ(altitude);
|
|
|
|
|
|
|
|
points.append(point);
|
|
|
|
|
|
|
|
p++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
polygon = NULL;
|
|
|
|
|
|
|
|
p = NULL;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
case UGGeometry::GeoLine3D:
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
UGGeoLine3D* line3D = (UGGeoLine3D*)pGeometry;
|
|
|
|
|
|
|
|
const UGPoint3D* p = line3D->GetPoints(); //节点指针
|
|
|
|
|
|
|
|
int nodeNum = line3D->GetPointCount(); //节点数
|
|
|
|
|
|
|
|
if (line3D->GetStartNode() == line3D->GetEndNode())
|
|
|
|
|
|
|
|
{//闭合航线,减去末尾重合航点
|
|
|
|
|
|
|
|
nodeNum--;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for(int i = 0;i<nodeNum;i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
point.setX(p->x);
|
|
|
|
|
|
|
|
point.setY(p->y);
|
|
|
|
|
|
|
|
point.setZ(p->z);
|
|
|
|
|
|
|
|
points.append(point);
|
|
|
|
|
|
|
|
p++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
line3D = NULL;
|
|
|
|
|
|
|
|
p = NULL;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取几何对象所有节点坐标(废弃)
|
|
|
|
|
|
|
|
/*
|
|
|
|
void GeoFeatureOperator::getNodePoints(UGRecordsetPtr res, UGint geometryType, QVector<QPointF> &points)
|
|
|
|
void GeoFeatureOperator::getNodePoints(UGRecordsetPtr res, UGint geometryType, QVector<QPointF> &points)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
res->MoveFirst(); //确保记录集指针是链表表头
|
|
|
|
res->MoveFirst(); //确保记录集指针是链表表头
|
|
|
@ -250,7 +325,7 @@ void GeoFeatureOperator::getNodePoints(UGRecordsetPtr res, UGint geometryType, Q
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
//线要素绘制
|
|
|
|
//线要素绘制
|
|
|
|
void GeoFeatureOperator::drawLine(QMapControl *qMapControl, UGDataSource *pDataSource, UGString datasetName)
|
|
|
|
void GeoFeatureOperator::drawLine(QMapControl *qMapControl, UGDataSource *pDataSource, UGString datasetName)
|
|
|
@ -289,7 +364,7 @@ void GeoFeatureOperator::drawLine(QMapControl *qMapControl, UGDataSource *pDataS
|
|
|
|
lineLayer = NULL;
|
|
|
|
lineLayer = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//3D线要素绘制
|
|
|
|
//3D线要素绘制(废弃)
|
|
|
|
void GeoFeatureOperator::drawLine3D(SceneView* pSceneView, UGString datasourceName, UGString datasetName)
|
|
|
|
void GeoFeatureOperator::drawLine3D(SceneView* pSceneView, UGString datasourceName, UGString datasetName)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SceneControl* pSceneControl = pSceneView->GetSceneControl();
|
|
|
|
SceneControl* pSceneControl = pSceneView->GetSceneControl();
|
|
|
@ -330,7 +405,7 @@ void GeoFeatureOperator::drawLine3D(SceneView* pSceneView, UGString datasourceNa
|
|
|
|
pSceneControl = NULL;
|
|
|
|
pSceneControl = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//3D线要素绘制
|
|
|
|
void GeoFeatureOperator::drawLine3D(SceneView *pSceneView, UGString dataName)
|
|
|
|
void GeoFeatureOperator::drawLine3D(SceneView *pSceneView, UGString dataName)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SceneControl* pSceneControl = pSceneView->GetSceneControl();
|
|
|
|
SceneControl* pSceneControl = pSceneView->GetSceneControl();
|
|
|
@ -373,10 +448,10 @@ void GeoFeatureOperator::drawLine3D(SceneView *pSceneView, UGString dataName)
|
|
|
|
pSceneView->isEditStateFlag = true;
|
|
|
|
pSceneView->isEditStateFlag = true;
|
|
|
|
|
|
|
|
|
|
|
|
//显示对话框
|
|
|
|
//显示对话框
|
|
|
|
// emit pSceneView->showSettingFlightPointDialg();
|
|
|
|
emit pSceneView->showSettingFlightPointDialg();
|
|
|
|
|
|
|
|
|
|
|
|
qDebug()<<"*******************Cursor:"<<pSceneControl->GetSceneEditWnd()->Get3DCursorShape();
|
|
|
|
// qDebug()<<"*******************Cursor:"<<pSceneControl->GetSceneEditWnd()->Get3DCursorShape();
|
|
|
|
qDebug()<<"*******************Cursor:"<<pSceneControl->GetSceneEditWnd()->m_SceneWindow.m_n3DCursorShape;
|
|
|
|
// qDebug()<<"*******************Cursor:"<<pSceneControl->GetSceneEditWnd()->m_SceneWindow.m_n3DCursorShape;
|
|
|
|
|
|
|
|
|
|
|
|
// dv = NULL;
|
|
|
|
// dv = NULL;
|
|
|
|
lineLayer3D = NULL;
|
|
|
|
lineLayer3D = NULL;
|
|
|
@ -384,6 +459,56 @@ void GeoFeatureOperator::drawLine3D(SceneView *pSceneView, UGString dataName)
|
|
|
|
pLayer3Ds = NULL;
|
|
|
|
pLayer3Ds = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//添加三维航点注记
|
|
|
|
|
|
|
|
void GeoFeatureOperator::addNodeLabel3D(UGRecordsetPtr res, UGTrackingLayer3D *pTrackingLayer3D)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// QMap<int, QVector3D> points;
|
|
|
|
|
|
|
|
// getNodePoints(res,points);
|
|
|
|
|
|
|
|
UGGeometry* pGeometry = NULL;
|
|
|
|
|
|
|
|
UGGeoLine3D* line3D = NULL;
|
|
|
|
|
|
|
|
UGPoint3D point;
|
|
|
|
|
|
|
|
UGString nodeTag;
|
|
|
|
|
|
|
|
UGVariant v;
|
|
|
|
|
|
|
|
res->MoveFirst();
|
|
|
|
|
|
|
|
while(!res->IsEOF())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
res->GetGeometry(pGeometry);
|
|
|
|
|
|
|
|
res->GetFieldValue(Translator::QStr2UGStr(routeGVar.routeFieldsName.RouteType),v);
|
|
|
|
|
|
|
|
int type = v.ToInt();
|
|
|
|
|
|
|
|
res->GetFieldValue(Translator::QStr2UGStr(routeGVar.routeFieldsName.RouteNumber),v);
|
|
|
|
|
|
|
|
UGString number = v.ToString();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
line3D = (UGGeoLine3D*)pGeometry;
|
|
|
|
|
|
|
|
int nodeCount = line3D->GetPointCount();
|
|
|
|
|
|
|
|
const UGPoint3D* points3D = line3D->GetPoints();
|
|
|
|
|
|
|
|
if(line3D->GetStartNode()==line3D->GetEndNode())
|
|
|
|
|
|
|
|
nodeCount--;
|
|
|
|
|
|
|
|
UGGeoText3D* geoText3D = new UGGeoText3D();
|
|
|
|
|
|
|
|
UGStyle3D style;
|
|
|
|
|
|
|
|
style.SetAltitudeMode(AltitudeMode::Absolute);
|
|
|
|
|
|
|
|
geoText3D->SetStyle3D(&style);
|
|
|
|
|
|
|
|
UGTextStyle textStyle = routeGVar.getLabelTextStyle(type);
|
|
|
|
|
|
|
|
geoText3D->SetTextStyle(textStyle);
|
|
|
|
|
|
|
|
for(int i = 0;i<nodeCount;i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
nodeTag = number + _U("-") + Translator::QStr2UGStr(QString::number(i+1));
|
|
|
|
|
|
|
|
point.x = points3D->x;
|
|
|
|
|
|
|
|
point.y = points3D->y;
|
|
|
|
|
|
|
|
point.z = points3D->z;
|
|
|
|
|
|
|
|
geoText3D->AddSub(nodeTag,point);
|
|
|
|
|
|
|
|
points3D++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UGString geoTextTag = Translator::QStr2UGStr(QString::number(type)) + _U("_") + number;
|
|
|
|
|
|
|
|
pTrackingLayer3D->Add(geoText3D,geoTextTag);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
res->MoveNext();
|
|
|
|
|
|
|
|
geoText3D = NULL;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
pGeometry = NULL;
|
|
|
|
|
|
|
|
line3D = NULL;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//添加三维几何对象到记录集
|
|
|
|
//添加三维几何对象到记录集
|
|
|
|
void GeoFeatureOperator::addGeometry3DToDataset(UGDatasetVector *dv, UGGeometry *pGeometry)
|
|
|
|
void GeoFeatureOperator::addGeometry3DToDataset(UGDatasetVector *dv, UGGeometry *pGeometry)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -487,3 +612,15 @@ int GeoFeatureOperator::importGeometry3DAttribute(UGDatasetVector *dv, UGGeometr
|
|
|
|
return 2;
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//创建三维地标对象
|
|
|
|
|
|
|
|
UGGeoPlacemark *GeoFeatureOperator::createGeoPlacemark(QVector3D point, QString strName)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
UGGeoPlacemark* geoPlacemark = new UGGeoPlacemark();
|
|
|
|
|
|
|
|
UGGeoPoint3D* point3D = new UGGeoPoint3D();
|
|
|
|
|
|
|
|
geoPlacemark->SetGeometry(point3D);
|
|
|
|
|
|
|
|
geoPlacemark->SetPosition(UGPoint3D(point.x(),point.y(),point.z()));
|
|
|
|
|
|
|
|
geoPlacemark->SetName(Translator::QStr2UGStr(strName));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return geoPlacemark;
|
|
|
|
|
|
|
|
}
|
|
|
|