|
|
|
@ -146,22 +146,35 @@ void UGSTDCALL AfterGeometryAddedCallback(UGlong pWnd, UGbool &bCancel, UGint nG
|
|
|
|
|
pControl->resetWayPointLabel();
|
|
|
|
|
UGRecordsetPtr editRes = pLayer->GetEditRecordset(); //只包含当前编辑线段的一条记录
|
|
|
|
|
// editRes->Edit();
|
|
|
|
|
UGGeometry* pGeometry = NULL;
|
|
|
|
|
UGGeoLine l;
|
|
|
|
|
editRes->GetGeometry(pGeometry);
|
|
|
|
|
|
|
|
|
|
UGDatasetVector* dv = (UGDatasetVector*)(pLayer->GetDataset().get());
|
|
|
|
|
|
|
|
|
|
//对地图操作一下,防止弹出Dialog后地图消失
|
|
|
|
|
QPoint p = pControl->getLMousePressPoint();
|
|
|
|
|
pControl->GetUGMapWnd()->OnMouseMove(pControl->getGraphics(),0,Translator::QPoint2UGPoint(p));
|
|
|
|
|
|
|
|
|
|
//超过最大航程进行告警提示
|
|
|
|
|
GeoComputation geoComputation;
|
|
|
|
|
double totalLength = geoComputation.getGeometryLength(pGeometry);
|
|
|
|
|
if(totalLength>g_MaxVoyage)
|
|
|
|
|
{
|
|
|
|
|
QMessageBox::warning(NULL,"警告","超过最大航程,请重新设计!");
|
|
|
|
|
bCancel = true;
|
|
|
|
|
pControl->GetMap()->m_Layers.ClearLayersSelection();
|
|
|
|
|
pControl->GetMap()->m_Layers.Remove(pLayer);
|
|
|
|
|
pControl->drawMode = 0;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//调出航线设置对话框
|
|
|
|
|
saveRouteDialog dlg;
|
|
|
|
|
dlg.setMaxValue(1);
|
|
|
|
|
dlg.setDrawMode(1);
|
|
|
|
|
int ret = dlg.exec();
|
|
|
|
|
|
|
|
|
|
UGGeometry* pGeometry = NULL;
|
|
|
|
|
UGGeoLine l;
|
|
|
|
|
editRes->GetGeometry(pGeometry);
|
|
|
|
|
|
|
|
|
|
QMap<QString,QString> fieldsValue;
|
|
|
|
|
GeoFeatureOperator geoFtOperator;
|
|
|
|
|
RouteGlobalVariant routeGVar;
|
|
|
|
@ -176,81 +189,25 @@ void UGSTDCALL AfterGeometryAddedCallback(UGlong pWnd, UGbool &bCancel, UGint nG
|
|
|
|
|
if(s==1)
|
|
|
|
|
{
|
|
|
|
|
bCancel = true;
|
|
|
|
|
pControl->drawMode = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(dlg.isClickedCloseBtn)
|
|
|
|
|
{
|
|
|
|
|
bCancel = true;
|
|
|
|
|
pControl->drawMode = 0;
|
|
|
|
|
}
|
|
|
|
|
/*
|
|
|
|
|
if(ret==QDialog::Accepted)
|
|
|
|
|
{
|
|
|
|
|
qint16 routeID_dlg = dv->GetObjectCount(); //数量为属性集已有记录数+1
|
|
|
|
|
double routeHeight_dlg = dlg.getRouteHeight()[1];
|
|
|
|
|
int routeType_dlg = dlg.getRouteType()[1];
|
|
|
|
|
int routeNumber_dlg = dlg.getRouteNumber()[1];
|
|
|
|
|
UGString routeName_dlg = Translator::QStr2UGStr(dlg.getRouteText()+QString::number(routeNumber_dlg));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QString queryFilter = "RouteType=" + QString::number(routeType_dlg) + " and " +
|
|
|
|
|
("RouteNumber=") + QString::number(routeNumber_dlg);
|
|
|
|
|
|
|
|
|
|
UGRecordsetPtr saveRes = pControl->queryFeature(dv,Translator::QStr2UGStr(queryFilter));
|
|
|
|
|
|
|
|
|
|
UGGeometry* pTem = NULL;
|
|
|
|
|
UGGeoLine l;
|
|
|
|
|
|
|
|
|
|
if(dlg.isCloseRoute())
|
|
|
|
|
{//自动闭合线段
|
|
|
|
|
editRes->GetGeometry(pTem,0);
|
|
|
|
|
pTem->ConvertToLine(l,0);
|
|
|
|
|
UGPoint2D addPoint = l.GetStartNode();
|
|
|
|
|
l.InsertPoint(0,l.GetPointCount(),addPoint); //添加首节点
|
|
|
|
|
editRes->SetGeometry(l); //替换原线段
|
|
|
|
|
editRes->ModifyFieldValue(_U("IsClosedRoute"),1);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
editRes->ModifyFieldValue(_U("IsClosedRoute"),0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!saveRes->IsEmpty())
|
|
|
|
|
{//记录已存在,覆盖
|
|
|
|
|
QMessageBox::StandardButton saveBtn;
|
|
|
|
|
saveBtn = QMessageBox::question(pControl, u8"提示", u8"航线已存在,是否覆盖?", QMessageBox::Yes|QMessageBox::No);
|
|
|
|
|
if (saveBtn == QMessageBox::Yes)
|
|
|
|
|
{
|
|
|
|
|
saveRes->Edit();
|
|
|
|
|
saveRes->SetGeometry(l);
|
|
|
|
|
saveRes->ModifyFieldValue(_U("RouteHeight"),UGVariant(routeHeight_dlg));
|
|
|
|
|
saveRes->Update();
|
|
|
|
|
bCancel = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{//航线不存在,新增航线
|
|
|
|
|
editRes->ModifyFieldValue(_U("RouteID"),UGVariant(routeID_dlg));
|
|
|
|
|
editRes->ModifyFieldValue(_U("RouteNumber"),UGVariant(routeNumber_dlg));
|
|
|
|
|
editRes->ModifyFieldValue(_U("RouteType"),UGVariant(routeType_dlg));
|
|
|
|
|
editRes->ModifyFieldValue(_U("RouteHeight"),UGVariant(routeHeight_dlg));
|
|
|
|
|
editRes->ModifyFieldValue(_U("RouteName"),UGVariant(routeName_dlg));
|
|
|
|
|
//提交记录修改
|
|
|
|
|
editRes->Update();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
if(ret==QDialog::Rejected)
|
|
|
|
|
{
|
|
|
|
|
bCancel = true;
|
|
|
|
|
pControl->drawMode = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// pControl->GetMap()->m_Layers.ClearLayersSelection();
|
|
|
|
|
// pControl->GetMap()->m_Layers.Remove(pLayer);
|
|
|
|
|
|
|
|
|
|
pControl->GetMap()->m_Layers.ClearLayersSelection();
|
|
|
|
|
pControl->GetMap()->m_Layers.Remove(pLayer);
|
|
|
|
|
dv = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2857,7 +2814,6 @@ void MainWindow::drawPoint()
|
|
|
|
|
pointLayer->SetSelectable(true); //设置图层可选择
|
|
|
|
|
pUGMap->m_Layers.SetEditableLayer(pointLayer,true);//设置图层可编辑
|
|
|
|
|
qMapControl->GetUGMapWnd()->SetUserAction(UGDrawParamaters::uaEdit,UGEditType::ET_Point);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|