//
#include <HYDROData_PolylineOperator.h>
+#include <HYDROData_Document.h>
#include <BRepBuilderAPI_MakeEdge2d.hxx>
+#include <BRepBuilderAPI_MakeWire.hxx>
#include <TopoDS_Edge.hxx>
+#include <TopoDS_Wire.hxx>
template<class T> void append( std::vector<T>& theList, const std::vector<T>& theList2 )
{
}
-bool HYDROData_PolylineOperator::Split( const Handle( HYDROData_PolylineXY )& thePolyline,
+bool HYDROData_PolylineOperator::Split( const Handle( HYDROData_Document )& theDoc,
+ const TCollection_AsciiString& theNamePrefix,
+ const Handle( HYDROData_PolylineXY )& thePolyline,
const gp_Pnt2d& thePoint ) const
{
std::vector<gp_Pnt2d> aPointsList( 1 );
for( int i=0, n=aCurves.size(); i<n; i++ )
{
std::vector<Handle( Geom2d_Curve )> aCurvesList = Split( aCurves[i], aPointsList );
- bool isLocalOK = CreatePolylines( aCurvesList );
+ bool isLocalOK = CreatePolylines( theDoc, theNamePrefix, aCurvesList );
isOK = isOK && isLocalOK;
}
return isOK;
}
-bool HYDROData_PolylineOperator::Split( const Handle( HYDROData_PolylineXY )& thePolyline,
+bool HYDROData_PolylineOperator::Split( const Handle( HYDROData_Document )& theDoc,
+ const TCollection_AsciiString& theNamePrefix,
+ const Handle( HYDROData_PolylineXY )& thePolyline,
const Handle( HYDROData_PolylineXY )& theTool ) const
{
std::vector<Handle( Geom2d_Curve )> aCurves = GetCurves( thePolyline );
{
std::vector<gp_Pnt2d> aPointsList = Intersection( aCurves[i], aToolCurves[j] );
std::vector<Handle( Geom2d_Curve )> aCurvesList = Split( aCurves[i], aPointsList );
- bool isLocalOK = CreatePolylines( aCurvesList );
+ bool isLocalOK = CreatePolylines( theDoc, theNamePrefix, aCurvesList );
isOK = isOK && isLocalOK;
}
return isOK;
}
-bool HYDROData_PolylineOperator::Split( const HYDROData_SequenceOfObjects& thePolylines )
+bool HYDROData_PolylineOperator::Split( const Handle( HYDROData_Document )& theDoc,
+ const TCollection_AsciiString& theNamePrefix,
+ const HYDROData_SequenceOfObjects& thePolylines )
{
int f = thePolylines.Lower(), l = thePolylines.Upper();
bool isOK = true;
append( aCompletePointsList, aPointsList );
}
std::vector<Handle( Geom2d_Curve )> aCurvesList = Split( anAllCurves[i], aCompletePointsList );
- bool isLocalOK = CreatePolylines( aCurvesList );
+ bool isLocalOK = CreatePolylines( theDoc, theNamePrefix, aCurvesList );
isOK = isOK && isLocalOK;
}
return isOK;
}
-bool HYDROData_PolylineOperator::Merge( const HYDROData_SequenceOfObjects& thePolylines )
+bool HYDROData_PolylineOperator::Merge( const Handle( HYDROData_Document )& theDoc,
+ const TCollection_AsciiString& theName,
+ const HYDROData_SequenceOfObjects& thePolylines )
{
//TODO
return true;
return aResult;
}
-bool HYDROData_PolylineOperator::CreatePolylines( const std::vector<Handle( Geom2d_Curve )>& theCurves )
+bool HYDROData_PolylineOperator::CreatePolylines( const Handle( HYDROData_Document )& theDoc,
+ const TCollection_AsciiString& theNamePrefix,
+ const std::vector<Handle( Geom2d_Curve )>& theCurves )
{
+ if( theDoc.IsNull() )
+ return false;
+
int n = theCurves.size();
for( int i=0; i<n; i++ )
{
TopoDS_Edge anEdge = BRepBuilderAPI_MakeEdge2d( theCurves[i] ).Edge();
- //TODO
+ BRepBuilderAPI_MakeWire aMakeWire;
+ aMakeWire.Add( anEdge );
+
+ Handle( HYDROData_PolylineXY ) aPolyline =
+ Handle( HYDROData_PolylineXY )::DownCast( theDoc->CreateObject( KIND_POLYLINEXY ) );
+ if( aPolyline.IsNull() )
+ return false;
+
+ aPolyline->SetShape( aMakeWire.Wire() );
+ //TODO: set name
}
return true;
}
#include <gp_Pnt2d.hxx>
#include <vector>
-class HYDROData_PolylineOperator
+class Handle( HYDROData_Document );
+
+class HYDRODATA_EXPORT HYDROData_PolylineOperator
{
public:
- HYDRODATA_EXPORT bool Split( const Handle( HYDROData_PolylineXY )& thePolyline,
- const gp_Pnt2d& thePoint ) const;
- HYDRODATA_EXPORT bool Split( const Handle( HYDROData_PolylineXY )& thePolyline,
- const Handle( HYDROData_PolylineXY )& theTool ) const;
- HYDRODATA_EXPORT bool Split( const HYDROData_SequenceOfObjects& thePolylines );
- HYDRODATA_EXPORT bool Merge( const HYDROData_SequenceOfObjects& thePolylines );
-
- static HYDRODATA_EXPORT std::vector<Handle( Geom2d_Curve )> GetCurves( const Handle( HYDROData_PolylineXY )& thePolyline );
-
- static HYDRODATA_EXPORT std::vector<gp_Pnt2d> Intersection( const Handle( Geom2d_Curve )& theCurve,
- const Handle( Geom2d_Curve )& theTool );
-
- static HYDRODATA_EXPORT std::vector<Handle( Geom2d_Curve )> Split( const Handle( Geom2d_Curve )& theCurve,
- const std::vector<gp_Pnt2d>& thePoints );
-
- static HYDRODATA_EXPORT bool CreatePolylines( const std::vector<Handle( Geom2d_Curve )>& theCurves );
+ bool Split( const Handle( HYDROData_Document )& theDoc,
+ const TCollection_AsciiString& theNamePrefix,
+ const Handle( HYDROData_PolylineXY )& thePolyline,
+ const gp_Pnt2d& thePoint ) const;
+ bool Split( const Handle( HYDROData_Document )& theDoc,
+ const TCollection_AsciiString& theNamePrefix,
+ const Handle( HYDROData_PolylineXY )& thePolyline,
+ const Handle( HYDROData_PolylineXY )& theTool ) const;
+ bool Split( const Handle( HYDROData_Document )& theDoc,
+ const TCollection_AsciiString& theNamePrefix,
+ const HYDROData_SequenceOfObjects& thePolylines );
+ bool Merge( const Handle( HYDROData_Document )& theDoc,
+ const TCollection_AsciiString& theName,
+ const HYDROData_SequenceOfObjects& thePolylines );
+
+protected:
+ static std::vector<Handle( Geom2d_Curve )> GetCurves( const Handle( HYDROData_PolylineXY )& thePolyline );
+
+ static std::vector<gp_Pnt2d> Intersection( const Handle( Geom2d_Curve )& theCurve,
+ const Handle( Geom2d_Curve )& theTool );
+
+ static std::vector<Handle( Geom2d_Curve )> Split( const Handle( Geom2d_Curve )& theCurve,
+ const std::vector<gp_Pnt2d>& thePoints );
+
+ static bool CreatePolylines( const Handle( HYDROData_Document )& theDoc,
+ const TCollection_AsciiString& theNamePrefix,
+ const std::vector<Handle( Geom2d_Curve )>& theCurves );
};
#endif
return getPolylineShape();
}
+bool HYDROData_PolylineXY::SetShape( const TopoDS_Shape& theShape )
+{
+ setPolylineShape( theShape );
+ return true;
+}
+
bool convertEdgeToSection( const TopoDS_Edge& theEdge,
NCollection_Sequence<TCollection_AsciiString>& theSectNames,
NCollection_Sequence<HYDROData_PolylineXY::SectionType>& theSectTypes,
* Returns the 2D presentation of all points.
*/
HYDRODATA_EXPORT virtual TopoDS_Shape GetShape() const;
+ HYDRODATA_EXPORT bool SetShape( const TopoDS_Shape& theShape );
/**
* Returns the 3D presentation of all points.
*/
HYDRODATA_EXPORT virtual bool ImportShape( const TopoDS_Shape& theShape );
-
/**
* Returns flag indicating that polyline can be edited or not.
*/
for( Standard_Integer anIndex = 1, aLength = aSeq.Length(); anIndex <= aLength; anIndex++ )
{
Handle(HYDROData_Entity) anObject = aSeq.Value( anIndex );
- if ( !anObject.IsNull() && !anObject->IsRemoved() )
+
+ if ( !anObject.IsNull() && !anObject->IsRemoved() ) {
anObject->Remove();
+ module()->setObjectRemoved( anObject );
+ }
}
commitDocOperation();
#include <HYDROData_Polyline3D.h>
#include <HYDROGUI_DataObject.h>
#include <HYDROData_Bathymetry.h>
+#include <HYDROData_LandCover.h>
#include <HYDROData_Profile.h>
#include <QFile>
#include <QFileInfo>
#include <SUIT_MessageBox.h>
+#include <TopoDS.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopoDS_Wire.hxx>
+#include <TopoDS_Vertex.hxx>
+#include <BRep_Tool.hxx>
+#include <Precision.hxx>
HYDROGUI_ExportFileOp::HYDROGUI_ExportFileOp( HYDROGUI_Module* theModule )
: HYDROGUI_Operation( theModule )
{
- setName( tr( "EXPORT_POLYLINE" ) );
+ setName( tr( "EXPORT_TO_SHAPE_FILE" ) );
}
HYDROGUI_ExportFileOp::~HYDROGUI_ExportFileOp()
{
HYDROGUI_Operation::startOperation();
- QString aFilter( "*.shp" ); //temp ext-n; replace with filter; TODO
+ QString aFilter( tr("SHP_FILTER") );
Handle(HYDROData_PolylineXY) aPolyXY;
Handle(HYDROData_Polyline3D) aPoly3D;
+ Handle(HYDROData_LandCover) aLC;
NCollection_Sequence<Handle_HYDROData_PolylineXY> aPolyXYSeq;
NCollection_Sequence<Handle_HYDROData_Polyline3D> aPoly3DSeq;
-
+ NCollection_Sequence<Handle_HYDROData_LandCover> aLCSeq;
HYDROData_SequenceOfObjects aSeq = HYDROGUI_Tool::GetSelectedObjects( module() );
for( int anIndex = 1, aLength = aSeq.Length(); anIndex <= aLength; anIndex++ )
aPoly3D = Handle(HYDROData_Polyline3D)::DownCast( aSeq.Value( anIndex ));
if (!aPoly3D.IsNull())
aPoly3DSeq.Append(aPoly3D);
+
+ aLC = Handle(HYDROData_LandCover)::DownCast( aSeq.Value( anIndex ));
+ if (!aLC.IsNull())
+ aLCSeq.Append(aLC);
}
if (!aPolyXYSeq.IsEmpty() && !aPoly3DSeq.IsEmpty())
SUIT_MessageBox::warning( module()->getApp()->desktop(), "Export Polyline", "Cannot export polylines of different kind");
else
{
- QString aFileName = SUIT_FileDlg::getFileName( module()->getApp()->desktop(), "", aFilter, tr( "EXPORT_POLYLINE" ), false );
+ QString aPolyName = "";
+ if (aPolyXYSeq.Size() == 1 && aPoly3DSeq.IsEmpty())
+ aPolyName = aPolyXYSeq(1)->GetName();
+ if (aPoly3DSeq.Size() == 1 && aPolyXYSeq.IsEmpty())
+ aPolyName = aPoly3DSeq(1)->GetName();
+ QString aFileName = SUIT_FileDlg::getFileName( module()->getApp()->desktop(), aPolyName, aFilter, tr( "EXPORT_TO_SHAPE_FILE" ), false );
if (!aFileName.isEmpty())
{
SHPHandle hSHPHandle;
hSHPHandle = SHPCreate( aFileName.toAscii().data(), SHPT_ARCZ );
for (int i = 1; i <= aPoly3DSeq.Size(); i++)
WriteObjectPoly3D(hSHPHandle, aPoly3DSeq(i));
- }
+ }
+ else if (aPolyXYSeq.IsEmpty() && aPoly3DSeq.IsEmpty() && !aLCSeq.IsEmpty())
+ {
+ hSHPHandle = SHPCreate( aFileName.toAscii().data(), SHPT_POLYGON );
+ for (int i = 1; i <= aLCSeq.Size(); i++)
+ WriteObjectLC(hSHPHandle, aLCSeq(i));
+ }
SHPClose( hSHPHandle );
commit();
}
SHPDestroyObject( aSHPObj );
}
+void HYDROGUI_ExportFileOp::WriteObjectLC(SHPHandle theShpHandle, Handle_HYDROData_LandCover theLC )
+{
+
+ TopoDS_Shape aSh = theLC->GetShape();
+ if (aSh.IsNull())
+ return;
+ if (aSh.ShapeType() == TopAbs_FACE)
+ {
+ ProcessFace(TopoDS::Face(aSh), theShpHandle);
+ }
+ else if (aSh.ShapeType() == TopAbs_COMPOUND)
+ {
+ TopExp_Explorer Ex(aSh, TopAbs_FACE);
+ for (; Ex.More(); Ex.Next())
+ {
+ TopoDS_Face aF = TopoDS::Face(Ex.Current());
+ if (aF.IsNull())
+ continue;
+ ProcessFace(aF, theShpHandle);
+ }
+ }
+ else
+ return;
+
+}
+
+void HYDROGUI_ExportFileOp::ProcessFace(TopoDS_Face theFace, SHPHandle theShpHandle)
+{
+ SHPObject *aSHPObj;
+ std::vector<double> x, y;
+ std::vector<int> anPartStart;
+ if (theFace.ShapeType() == TopAbs_FACE)
+ {
+ TopExp_Explorer Ex(theFace, TopAbs_WIRE);
+ int NbWires = 0;
+ for (; Ex.More(); Ex.Next())
+ {
+ TopoDS_Wire aW = TopoDS::Wire(Ex.Current());
+ if (aW.IsNull())
+ continue;
+ NbWires++;
+ anPartStart.push_back(x.size());
+ TopExp_Explorer aVEx(aW, TopAbs_VERTEX);
+ NCollection_Sequence<gp_Pnt2d> aPnts;
+ for (; aVEx.More(); aVEx.Next())
+ {
+ TopoDS_Vertex aV = TopoDS::Vertex(aVEx.Current());
+ if (aV.IsNull())
+ continue;
+ gp_Pnt P = BRep_Tool::Pnt(aV);
+ aPnts.Append(gp_Pnt2d(P.X(), P.Y()));
+ }
+ NCollection_Sequence<gp_Pnt2d> aNPnts;
+ aNPnts.Append(aPnts.First());
+ for (int j = 1; j <= aPnts.Size() - 1; j++)
+ {
+ if (!aPnts(j).IsEqual(aPnts(j + 1), Precision::Confusion()))
+ aNPnts.Append(aPnts(j + 1));
+ }
+ for (int j = 1; j <= aNPnts.Size(); j++)
+ {
+ x.push_back( aNPnts(j).X());
+ y.push_back( aNPnts(j).Y());
+ }
+ //x.push_back( aNPnts(1).X());
+ //y.push_back( aNPnts(1).Y());
+ }
+
+ aSHPObj = SHPCreateObject( SHPT_POLYGON, -1, NbWires, &anPartStart[0], NULL, x.size(), &x[0], &y[0], NULL, NULL );
+ SHPWriteObject( theShpHandle, -1, aSHPObj );
+ SHPDestroyObject( aSHPObj );
+ }
+ else
+ return;
+}
class gp_XYZ;
class Handle_HYDROData_PolylineXY;
class Handle_HYDROData_Polyline3D;
+class Handle_HYDROData_LandCover;
+class TopoDS_Face;
class HYDROGUI_ExportFileOp : public HYDROGUI_Operation
{
virtual void startOperation();
void WriteObjectPolyXY(SHPHandle theShpHandle, Handle_HYDROData_PolylineXY thePoly );
void WriteObjectPoly3D(SHPHandle theShpHandle, Handle_HYDROData_Polyline3D thePoly );
+ void WriteObjectLC(SHPHandle theShpHandle, Handle_HYDROData_LandCover theLC );
+private:
+ void ProcessFace(TopoDS_Face theFace, SHPHandle theShpHandle);
private:
SUIT_FileDlg* myFileDlg;
std::vector<SHPObject*> mySHPObjects;
--- /dev/null
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "HYDROGUI_ImportLandCoverOp.h"
+
+#include "HYDROGUI_DataModel.h"
+#include "HYDROGUI_Module.h"
+#include "HYDROGUI_UpdateFlags.h"
+#include "HYDROGUI_Tool.h"
+#include "HYDROGUI_ImportLandCoverDlg.h"
+#include "HYDROGUI_Shape.h"
+#include <HYDROData_LandCover.h>
+#include <HYDROGUI_ZLayers.h>
+
+#include <HYDROGUI_DataObject.h>
+#include <HYDROData_Iterator.h>
+
+#include <HYDROData_Profile.h>
+
+#include <SUIT_Desktop.h>
+#include <SUIT_FileDlg.h>
+#include <LightApp_Application.h>
+
+#include <QApplication>
+#include <QFile>
+#include <QFileInfo>
+#include <SUIT_MessageBox.h>
+
+#include <OCCViewer_ViewManager.h>
+#include <OCCViewer_ViewModel.h>
+
+#include <SalomeApp_Study.h>
+
+#include <LightApp_Application.h>
+#include <LightApp_DataOwner.h>
+#include <LightApp_Displayer.h>
+#include <LightApp_SelectionMgr.h>
+
+#include <SUIT_Desktop.h>
+#include <SUIT_ViewManager.h>
+
+#include <BRep_Builder.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Wire.hxx>
+#include <BRepBuilderAPI_MakeEdge.hxx>
+#include <BRepBuilderAPI_MakeWire.hxx>
+#include <BRepBuilderAPI_MakeFace.hxx>
+#include <gp_Pln.hxx>
+#include <BRepLib.hxx>
+#include <ShapeFix_Shape.hxx>
+
+
+HYDROGUI_ImportLandCoverOp::HYDROGUI_ImportLandCoverOp( HYDROGUI_Module* theModule )
+: HYDROGUI_Operation( theModule )
+{
+ setName( tr( "IMPORT_LANDCOVER" ) );
+}
+
+HYDROGUI_ImportLandCoverOp::~HYDROGUI_ImportLandCoverOp()
+{
+ erasePreview();
+}
+
+void HYDROGUI_ImportLandCoverOp::startOperation()
+{
+ HYDROGUI_Operation::startOperation();
+
+ if ( !getPreviewManager() ) {
+ setPreviewManager( ::qobject_cast<OCCViewer_ViewManager*>(
+ module()->getApp()->getViewManager( OCCViewer_Viewer::Type(), true ) ) );
+ }
+
+ if ( !isApplyAndClose() ) {
+ return;
+ }
+
+ HYDROGUI_ImportLandCoverDlg* aPanel =
+ ::qobject_cast<HYDROGUI_ImportLandCoverDlg*>( inputPanel() );
+ if ( !aPanel ) {
+ return;
+ }
+
+ aPanel->reset();
+}
+
+
+HYDROGUI_InputPanel* HYDROGUI_ImportLandCoverOp::createInputPanel() const
+{
+ HYDROGUI_InputPanel* aPanel = new HYDROGUI_ImportLandCoverDlg( module(), getName() );
+
+ connect( aPanel, SIGNAL( FileSelected( const QString& ) ), SLOT( onFileSelected() ) );
+
+ connect( aPanel, SIGNAL( selectionChanged( const QStringList& ) ), this, SLOT( onSelectionChanged( const QStringList& ) ) );
+
+ return aPanel;
+}
+
+bool HYDROGUI_ImportLandCoverOp::processApply( int& theUpdateFlags,
+ QString& theErrorMsg,
+ QStringList& theBrowseObjectsEntries )
+{
+
+ HYDROGUI_ImportLandCoverDlg* aPanel = ::qobject_cast<HYDROGUI_ImportLandCoverDlg*>( inputPanel() );
+ if ( !aPanel ) {
+ return false;
+ }
+
+ QStringList aSelectedtPolygons = aPanel->getSelectedPolygonNames();
+ aPanel->removePolygonNames( aSelectedtPolygons );
+
+ if (!aSelectedtPolygons.empty())
+ {
+ Handle(HYDROData_LandCover) aLC = Handle(HYDROData_LandCover)::DownCast( doc()->CreateObject( KIND_LAND_COVER ) );
+ TopoDS_Shape aResShape;
+ if (aSelectedtPolygons.size() > 1)
+ {
+ TopoDS_Compound cmp;
+ BRep_Builder BB;
+ BB.MakeCompound(cmp);
+
+ foreach ( QString aName, aSelectedtPolygons ) {
+ TopoDS_Shape aShape = myPolygonName2PrsShape.value( aName )->getTopoShape();
+ if ( aShape.IsNull() )
+ continue;
+ BB.Add(cmp, aShape);
+ HYDROGUI_Shape* aShapeToDelete = myPolygonName2PrsShape.take( aName );
+ delete aShapeToDelete;
+ }
+ aResShape = cmp;
+ }
+ else
+ {
+ TopoDS_Shape aShape = myPolygonName2PrsShape.value( aSelectedtPolygons.first() )->getTopoShape();
+ if ( !aShape.IsNull() )
+ {
+ HYDROGUI_Shape* aShapeToDelete = myPolygonName2PrsShape.take( aSelectedtPolygons.first() );
+ delete aShapeToDelete;
+ aResShape = aShape;
+ }
+ }
+ if( !aLC.IsNull() )
+ {
+ QString aLCName = aPanel->getObjectName() + "_polygon";
+ int i = 0;
+ for( ;HYDROGUI_Tool::FindObjectByName(module(), aLCName); i++)
+ aLCName = aPanel->getObjectName() + "_polygon_" + QString::number(i);
+ aLC->SetName( aLCName );
+ aLC->SetFillingColor( HYDROData_LandCover::DefaultFillingColor() );
+ aLC->SetBorderColor( HYDROData_LandCover::DefaultBorderColor() );
+
+ aLC->setShape(aResShape);
+ aLC->Show();
+
+ //erasePreview();
+
+ module()->setIsToUpdate( aLC );
+
+ }
+ }
+
+ module()->update( UF_Model | UF_VTKViewer | UF_VTK_Forced | UF_VTK_Init );
+
+ if ( isApplyAndClose() )
+ erasePreview();
+
+ return true;
+}
+
+
+void HYDROGUI_ImportLandCoverOp::Parse(SHPHandle theHandle)
+{
+ int aShapeType;
+ mySHPObjects.clear();
+ SHPGetInfo( theHandle, NULL, &aShapeType, NULL, NULL );
+ if (aShapeType == 5)
+ {
+ for (int i = 0; i < theHandle->nRecords; i++)
+ mySHPObjects.push_back(SHPReadObject(theHandle, i));
+ }
+}
+
+void HYDROGUI_ImportLandCoverOp::ProcessSHP(SHPObject* anObj, int i, TopoDS_Face& F)
+{
+ TopoDS_Wire W;
+ TopoDS_Edge E;
+ int nParts = anObj->nParts;
+ gp_Pln pln(gp_Pnt(0,0,0), gp_Dir(0,0,1));
+ BRepBuilderAPI_MakeFace aFBuilder(pln);
+
+ //Handle(ShapeFix_Shape) sfs = new ShapeFix_Shape;
+ //sfs->FixFaceTool()->FixOrientationMode() = 1;
+
+ for ( int i = 0 ; i < nParts ; i++ )
+ {
+ BRepBuilderAPI_MakeWire aBuilder;
+ int StartIndex = anObj->panPartStart[i];
+ int EndIndex;
+ if (i != nParts - 1)
+ EndIndex = anObj->panPartStart[i + 1];
+ else
+ EndIndex = anObj->nVertices;
+
+ for ( int k = StartIndex; k < EndIndex - 1 ; k++ )
+ {
+ gp_Pnt P1 (anObj->padfX[k], anObj->padfY[k], 0);
+ gp_Pnt P2 (anObj->padfX[k+1], anObj->padfY[k+1], 0);
+ if (P1.Distance(P2) < Precision::Confusion())
+ continue;
+ BRepBuilderAPI_MakeEdge aMakeEdge(P1, P2);
+ aBuilder.Add(TopoDS::Edge(aMakeEdge.Shape()));
+ }
+
+ aBuilder.Build();
+ W = TopoDS::Wire(aBuilder.Shape());
+ W.Reverse();
+ aFBuilder.Add(W);
+ }
+
+ aFBuilder.Build();
+ TopoDS_Face DF = aFBuilder.Face();
+ BRepLib::BuildCurves3d(DF);
+ bool IsInf = DF.Infinite();
+ if(!DF.IsNull())
+ {
+ //sfs->Init ( DF );
+ //sfs->Perform();
+ F = DF; //TopoDS::Face(sfs->Shape());
+ }
+}
+
+void HYDROGUI_ImportLandCoverOp::onFileSelected()
+{
+ HYDROGUI_ImportLandCoverDlg* aPanel = ::qobject_cast<HYDROGUI_ImportLandCoverDlg*>( inputPanel() );
+ if ( !aPanel )
+ return;
+
+ QString anObjectName = aPanel->getObjectName().simplified();
+ anObjectName = aPanel->getFileName();
+ if ( !anObjectName.isEmpty() )
+ anObjectName = QFileInfo( anObjectName ).baseName();
+
+ if ( anObjectName.isEmpty() )
+ anObjectName = HYDROGUI_Tool::GenerateObjectName( module(), tr( "DEFAULT_LANDCOVER_NAME" ) );
+ aPanel->setObjectName( anObjectName );
+
+ QString aFileName = aPanel->getFileName();
+ if ( aFileName.isEmpty() )
+ {
+ abort();
+ return;
+ }
+
+ QString anExt = aFileName.split('.', QString::SkipEmptyParts).back();
+
+ if (anExt == "shp")
+ {
+ SHPHandle aHSHP;
+ aHSHP = SHPOpen( aFileName.toAscii().data(), "rb" );
+ Parse(aHSHP);
+
+ startDocOperation();
+ QStringList aPolygonsList;
+ for (int i = 0; i < mySHPObjects.size(); i++)
+ aPolygonsList.append("polygon_" + QString::number(i + 1));
+ aPanel->setPolygonNames(aPolygonsList);
+
+ SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( module()->getApp()->activeStudy() );
+ if ( !aStudy ) {
+ return;
+ }
+
+ erasePreview();
+
+ Handle(AIS_InteractiveContext) aCtx = NULL;
+
+ LightApp_Application* anApp = module()->getApp();
+ if ( !getPreviewManager() )
+ setPreviewManager( ::qobject_cast<OCCViewer_ViewManager*>( anApp->getViewManager( OCCViewer_Viewer::Type(), true ) ) );
+ OCCViewer_ViewManager* aViewManager = getPreviewManager();
+
+ if ( aViewManager )
+ {
+ if ( OCCViewer_Viewer* aViewer = aViewManager->getOCCViewer() )
+ {
+ aCtx = aViewer->getAISContext();
+ connect( aViewer, SIGNAL( selectionChanged() ), this, SLOT( onViewerSelectionChanged() ) );
+ }
+ }
+
+ QApplication::setOverrideCursor(Qt::WaitCursor);
+
+ TopTools_SequenceOfShape aFaces;
+ TopoDS_Face aF;
+ if (aHSHP->nShapeType == 5)
+ {
+ for (int i = 0; i < mySHPObjects.size(); i++)
+ {
+ ProcessSHP(mySHPObjects[i], i, aF);
+ aFaces.Append(aF);
+ }
+ }
+ else
+ SUIT_MessageBox::warning( module()->getApp()->desktop(), tr( "IMPORT_LANDCOVER" ), "Cannot import land cover;\nThe shape type is not polygon" );
+ QApplication::restoreOverrideCursor();
+
+ Handle(HYDROData_LandCover) aLC = Handle(HYDROData_LandCover)::DownCast( doc()->CreateObject( KIND_LAND_COVER ) );
+ for ( int i = 1; i <= aFaces.Length(); i++ )
+ {
+ TopoDS_Face aFace = TopoDS::Face(aFaces.Value( i ));
+
+ aLC->setShape( aFace );
+
+ if ( aViewManager && !aCtx.IsNull() )
+ {
+ HYDROGUI_Shape* aShape = new HYDROGUI_Shape( aCtx, NULL, getPreviewZLayer() );
+
+ aShape->setFillingColor( HYDROData_LandCover::DefaultFillingColor(), false, false );
+ aShape->setBorderColor( HYDROData_LandCover::DefaultBorderColor(), false, false );
+ if( !aFace.IsNull() )
+ aShape->setShape( aLC->GetShape() );
+ myPolygonName2PrsShape.insert( "polygon_" + QString::number(i), aShape);
+ }
+ }
+ aLC->Remove();
+
+ if ( !aCtx.IsNull() ) {
+ UpdateZLayersOfHilightPresentationsOfDisplayedObjects( aCtx, Graphic3d_ZLayerId_TopOSD );
+ aCtx->UpdateCurrentViewer();
+ }
+
+ commitDocOperation();
+
+ for (size_t i = 0; i < mySHPObjects.size(); i++ )
+ free (mySHPObjects[i]);
+
+ mySHPObjects.clear();
+ SHPClose(aHSHP);
+ }
+
+}
+
+void HYDROGUI_ImportLandCoverOp::onSelectionChanged( const QStringList& theSelectedNames )
+{
+ Handle(AIS_InteractiveContext) aCtx = NULL;
+
+ OCCViewer_ViewManager* aViewManager = getPreviewManager();
+ if ( aViewManager ) {
+ if ( OCCViewer_Viewer* aViewer = aViewManager->getOCCViewer() ) {
+ aCtx = aViewer->getAISContext();
+ }
+ }
+
+ if ( !aCtx.IsNull() ) {
+ foreach ( QString aName, myPolygonName2PrsShape.keys() ) {
+ Handle(AIS_InteractiveObject) anObject =
+ myPolygonName2PrsShape.value(aName)->getAISObject();
+
+ bool isSelected = theSelectedNames.contains( aName );
+ if ( ( isSelected && !aCtx->IsSelected( anObject) ) ||
+ ( !isSelected && aCtx->IsSelected( anObject) ) ) {
+ aCtx->AddOrRemoveSelected( anObject, Standard_False );
+ }
+ }
+ aCtx->UpdateCurrentViewer();
+ }
+}
+
+
+void HYDROGUI_ImportLandCoverOp::onViewerSelectionChanged()
+{
+ // Get panel
+ HYDROGUI_ImportLandCoverDlg* aPanel = ::qobject_cast<HYDROGUI_ImportLandCoverDlg*>( inputPanel() );
+ if ( !aPanel ) {
+ return;
+ }
+
+ OCCViewer_ViewManager* aViewManager = getPreviewManager();
+ Handle(AIS_InteractiveContext) aCtx = NULL;
+ if ( aViewManager ) {
+ if ( OCCViewer_Viewer* aViewer = aViewManager->getOCCViewer() ) {
+ aCtx = aViewer->getAISContext();
+ }
+ }
+
+ if ( !aCtx.IsNull() )
+ {
+ QStringList aSelectedNames;
+ foreach ( QString aName, myPolygonName2PrsShape.keys() ) {
+ bool isSelected = aCtx->IsSelected( myPolygonName2PrsShape.value(aName)->getAISObject() );
+ if ( isSelected ) {
+ aSelectedNames << aName;
+ }
+ }
+ aPanel->setSelectedPolygonNames( aSelectedNames );
+ }
+}
+
+
+void HYDROGUI_ImportLandCoverOp::erasePreview()
+{
+ foreach ( HYDROGUI_Shape* aShape, myPolygonName2PrsShape ) {
+ delete aShape;
+ }
+
+ myPolygonName2PrsShape.clear();
+}
+
+
+void HYDROGUI_ImportLandCoverOp::abortOperation()
+{
+ LightApp_Application* anApp = module()->getApp();
+ if ( anApp ) {
+ anApp->disconnect( this );
+ }
+
+ erasePreview();
+
+ HYDROGUI_Operation::abortOperation();
+}
+
+
--- /dev/null
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef HYDROGUI_IMPORTLANDCOVER_H
+#define HYDROGUI_IMPORTLANDCOVER_H
+
+#include "HYDROGUI_Operation.h"
+#include <vector>
+#include <QMap>
+
+//extern "C" {
+#include <shapelib/shapefil.h>
+//};
+
+class SUIT_FileDlg;
+class HYDROGUI_Shape;
+class TopoDS_Face;
+
+
+class HYDROGUI_ImportLandCoverOp : public HYDROGUI_Operation
+{
+ Q_OBJECT
+
+public:
+ HYDROGUI_ImportLandCoverOp( HYDROGUI_Module* theModule );
+ virtual ~HYDROGUI_ImportLandCoverOp();
+
+protected:
+ virtual void startOperation();
+ virtual void abortOperation();
+
+ virtual bool processApply( int& theUpdateFlags, QString& theErrorMsg, QStringList& theBrowseObjectsEntries );
+ HYDROGUI_InputPanel* createInputPanel() const;
+ void Parse(SHPHandle theHandle);
+ void ProcessSHP(SHPObject* anObj, int i, TopoDS_Face& F);
+ void erasePreview();
+
+protected slots:
+ void onFileSelected();
+ void onSelectionChanged( const QStringList& theSelectedNames );
+ void onViewerSelectionChanged ();
+
+private:
+ std::vector<SHPObject*> mySHPObjects;
+ QMap<QString, HYDROGUI_Shape*> myPolygonName2PrsShape;
+};
+
+#endif
+++ /dev/null
-// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-#include "HYDROGUI_ImportLandCoverOp.h"
-
-#include "HYDROGUI_DataModel.h"
-#include "HYDROGUI_Module.h"
-#include "HYDROGUI_UpdateFlags.h"
-#include "HYDROGUI_Tool.h"
-#include "HYDROGUI_ImportLandCoverDlg.h"
-#include "HYDROGUI_Shape.h"
-#include <HYDROData_LandCover.h>
-#include <HYDROGUI_ZLayers.h>
-
-#include <HYDROGUI_DataObject.h>
-#include <HYDROData_Iterator.h>
-
-#include <HYDROData_Profile.h>
-
-#include <SUIT_Desktop.h>
-#include <SUIT_FileDlg.h>
-#include <LightApp_Application.h>
-
-#include <QApplication>
-#include <QFile>
-#include <QFileInfo>
-#include <SUIT_MessageBox.h>
-
-#include <OCCViewer_ViewManager.h>
-#include <OCCViewer_ViewModel.h>
-
-#include <SalomeApp_Study.h>
-
-#include <LightApp_Application.h>
-#include <LightApp_DataOwner.h>
-#include <LightApp_Displayer.h>
-#include <LightApp_SelectionMgr.h>
-
-#include <SUIT_Desktop.h>
-#include <SUIT_ViewManager.h>
-
-#include <BRep_Builder.hxx>
-#include <TopoDS.hxx>
-#include <TopoDS_Shape.hxx>
-#include <TopoDS_Wire.hxx>
-#include <BRepBuilderAPI_MakeEdge.hxx>
-#include <BRepBuilderAPI_MakeWire.hxx>
-#include <BRepBuilderAPI_MakeFace.hxx>
-#include <gp_Pln.hxx>
-#include <BRepLib.hxx>
-#include <ShapeFix_Shape.hxx>
-
-
-HYDROGUI_ImportLandCoverOp::HYDROGUI_ImportLandCoverOp( HYDROGUI_Module* theModule )
-: HYDROGUI_Operation( theModule )
-{
- setName( tr( "IMPORT_LANDCOVER" ) );
-}
-
-HYDROGUI_ImportLandCoverOp::~HYDROGUI_ImportLandCoverOp()
-{
- erasePreview();
-}
-
-void HYDROGUI_ImportLandCoverOp::startOperation()
-{
- HYDROGUI_Operation::startOperation();
-
- if ( !getPreviewManager() ) {
- setPreviewManager( ::qobject_cast<OCCViewer_ViewManager*>(
- module()->getApp()->getViewManager( OCCViewer_Viewer::Type(), true ) ) );
- }
-
- if ( !isApplyAndClose() ) {
- return;
- }
-
- HYDROGUI_ImportLandCoverDlg* aPanel =
- ::qobject_cast<HYDROGUI_ImportLandCoverDlg*>( inputPanel() );
- if ( !aPanel ) {
- return;
- }
-
- aPanel->reset();
-}
-
-
-HYDROGUI_InputPanel* HYDROGUI_ImportLandCoverOp::createInputPanel() const
-{
- HYDROGUI_InputPanel* aPanel = new HYDROGUI_ImportLandCoverDlg( module(), getName() );
-
- connect( aPanel, SIGNAL( FileSelected( const QString& ) ), SLOT( onFileSelected() ) );
-
- connect( aPanel, SIGNAL( selectionChanged( const QStringList& ) ), this, SLOT( onSelectionChanged( const QStringList& ) ) );
-
- return aPanel;
-}
-
-bool HYDROGUI_ImportLandCoverOp::processApply( int& theUpdateFlags,
- QString& theErrorMsg,
- QStringList& theBrowseObjectsEntries )
-{
-
- HYDROGUI_ImportLandCoverDlg* aPanel = ::qobject_cast<HYDROGUI_ImportLandCoverDlg*>( inputPanel() );
- if ( !aPanel ) {
- return false;
- }
-
- QStringList aSelectedtPolygons = aPanel->getSelectedPolygonNames();
- aPanel->removePolygonNames( aSelectedtPolygons );
-
- if (!aSelectedtPolygons.empty())
- {
- Handle(HYDROData_LandCover) aLC = Handle(HYDROData_LandCover)::DownCast( doc()->CreateObject( KIND_LAND_COVER ) );
- TopoDS_Shape aResShape;
- if (aSelectedtPolygons.size() > 1)
- {
- TopoDS_Compound cmp;
- BRep_Builder BB;
- BB.MakeCompound(cmp);
-
- foreach ( QString aName, aSelectedtPolygons ) {
- TopoDS_Shape aShape = myPolygonName2PrsShape.value( aName )->getTopoShape();
- if ( aShape.IsNull() )
- continue;
- BB.Add(cmp, aShape);
- HYDROGUI_Shape* aShapeToDelete = myPolygonName2PrsShape.take( aName );
- delete aShapeToDelete;
- }
- aResShape = cmp;
- }
- else
- {
- TopoDS_Shape aShape = myPolygonName2PrsShape.value( aSelectedtPolygons.first() )->getTopoShape();
- if ( !aShape.IsNull() )
- {
- HYDROGUI_Shape* aShapeToDelete = myPolygonName2PrsShape.take( aSelectedtPolygons.first() );
- delete aShapeToDelete;
- aResShape = aShape;
- }
- }
- if( !aLC.IsNull() )
- {
- QString aLCName = aPanel->getObjectName() + "_polygon";
- int i = 0;
- for( ;HYDROGUI_Tool::FindObjectByName(module(), aLCName); i++)
- aLCName = aPanel->getObjectName() + "_polygon_" + QString::number(i);
- aLC->SetName( aLCName );
- aLC->SetFillingColor( HYDROData_LandCover::DefaultFillingColor() );
- aLC->SetBorderColor( HYDROData_LandCover::DefaultBorderColor() );
-
- aLC->setShape(aResShape);
- aLC->Show();
-
- //erasePreview();
-
- module()->setIsToUpdate( aLC );
-
- }
- }
-
- module()->update( UF_Model | UF_VTKViewer | UF_VTK_Forced | UF_VTK_Init );
-
- if ( isApplyAndClose() )
- erasePreview();
-
- return true;
-}
-
-
-void HYDROGUI_ImportLandCoverOp::Parse(SHPHandle theHandle)
-{
- int aShapeType;
- mySHPObjects.clear();
- SHPGetInfo( theHandle, NULL, &aShapeType, NULL, NULL );
- if (aShapeType == 5)
- {
- for (int i = 0; i < theHandle->nRecords; i++)
- mySHPObjects.push_back(SHPReadObject(theHandle, i));
- }
-}
-
-void HYDROGUI_ImportLandCoverOp::ProcessSHP(SHPObject* anObj, int i, TopoDS_Face& F)
-{
- TopoDS_Wire W;
- TopoDS_Edge E;
- int nParts = anObj->nParts;
- gp_Pln pln(gp_Pnt(0,0,0), gp_Dir(0,0,1));
- BRepBuilderAPI_MakeFace aFBuilder(pln);
-
- //Handle(ShapeFix_Shape) sfs = new ShapeFix_Shape;
- //sfs->FixFaceTool()->FixOrientationMode() = 1;
-
- for ( int i = 0 ; i < nParts ; i++ )
- {
- BRepBuilderAPI_MakeWire aBuilder;
- int StartIndex = anObj->panPartStart[i];
- int EndIndex;
- if (i != nParts - 1)
- EndIndex = anObj->panPartStart[i + 1];
- else
- EndIndex = anObj->nVertices;
-
- for ( int k = StartIndex; k < EndIndex - 1 ; k++ )
- {
- gp_Pnt P1 (anObj->padfX[k], anObj->padfY[k], 0);
- gp_Pnt P2 (anObj->padfX[k+1], anObj->padfY[k+1], 0);
- BRepBuilderAPI_MakeEdge aMakeEdge(P1, P2);
- aBuilder.Add(TopoDS::Edge(aMakeEdge.Shape()));
- }
-
- aBuilder.Build();
- W = TopoDS::Wire(aBuilder.Shape());
- W.Reverse();
- aFBuilder.Add(W);
- }
-
- aFBuilder.Build();
- TopoDS_Face DF = aFBuilder.Face();
- BRepLib::BuildCurves3d(DF);
- if(!DF.IsNull())
- {
- //sfs->Init ( DF );
- //sfs->Perform();
- F = DF; //TopoDS::Face(sfs->Shape());
- }
-}
-
-void HYDROGUI_ImportLandCoverOp::onFileSelected()
-{
- HYDROGUI_ImportLandCoverDlg* aPanel = ::qobject_cast<HYDROGUI_ImportLandCoverDlg*>( inputPanel() );
- if ( !aPanel )
- return;
-
- QString anObjectName = aPanel->getObjectName().simplified();
- anObjectName = aPanel->getFileName();
- if ( !anObjectName.isEmpty() )
- anObjectName = QFileInfo( anObjectName ).baseName();
-
- if ( anObjectName.isEmpty() )
- anObjectName = HYDROGUI_Tool::GenerateObjectName( module(), tr( "DEFAULT_LANDCOVER_NAME" ) );
- aPanel->setObjectName( anObjectName );
-
- QString aFileName = aPanel->getFileName();
- if ( aFileName.isEmpty() )
- {
- abort();
- return;
- }
-
- QString anExt = aFileName.split('.', QString::SplitBehavior::SkipEmptyParts).back();
-
- if (anExt == "shp")
- {
- SHPHandle aHSHP;
- aHSHP = SHPOpen( aFileName.toAscii().data(), "rb" );
- Parse(aHSHP);
-
- startDocOperation();
- QStringList aPolygonsList;
- for (int i = 1; i < mySHPObjects.size(); i++)
- aPolygonsList.append("polygon_" + QString::number(i));
- aPanel->setPolygonNames(aPolygonsList);
-
- SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( module()->getApp()->activeStudy() );
- if ( !aStudy ) {
- return;
- }
-
- erasePreview();
-
- Handle(AIS_InteractiveContext) aCtx = NULL;
-
- LightApp_Application* anApp = module()->getApp();
- if ( !getPreviewManager() )
- setPreviewManager( ::qobject_cast<OCCViewer_ViewManager*>( anApp->getViewManager( OCCViewer_Viewer::Type(), true ) ) );
- OCCViewer_ViewManager* aViewManager = getPreviewManager();
-
- if ( aViewManager )
- {
- if ( OCCViewer_Viewer* aViewer = aViewManager->getOCCViewer() )
- {
- aCtx = aViewer->getAISContext();
- connect( aViewer, SIGNAL( selectionChanged() ), this, SLOT( onViewerSelectionChanged() ) );
- }
- }
-
- QApplication::setOverrideCursor(Qt::WaitCursor);
-
- TopTools_SequenceOfShape aFaces;
- TopoDS_Face aF;
- if (aHSHP->nShapeType == 5)
- {
- for (int i = 0; i < mySHPObjects.size(); i++)
- {
- ProcessSHP(mySHPObjects[i], i, aF);
- aFaces.Append(aF);
- }
- }
- else
- SUIT_MessageBox::warning( module()->getApp()->desktop(), "Import Land cover", "Cannot land cover;\nThe shape type is not polygon" );
- QApplication::restoreOverrideCursor();
-
- Handle(HYDROData_LandCover) aLC = Handle(HYDROData_LandCover)::DownCast( doc()->CreateObject( KIND_LAND_COVER ) );
- for ( int i = 1; i <= aFaces.Length(); i++ )
- {
- TopoDS_Face aFace = TopoDS::Face(aFaces.Value( i ));
-
- aLC->setShape( aFace );
-
- if ( aViewManager && !aCtx.IsNull() )
- {
- HYDROGUI_Shape* aShape = new HYDROGUI_Shape( aCtx, NULL, getPreviewZLayer() );
-
- aShape->setFillingColor( HYDROData_LandCover::DefaultFillingColor(), false, false );
- aShape->setBorderColor( HYDROData_LandCover::DefaultBorderColor(), false, false );
- if( !aFace.IsNull() )
- aShape->setShape( aLC->GetShape() );
- myPolygonName2PrsShape.insert( "polygon_" + QString::number(i), aShape);
- }
- }
- aLC->Remove();
-
- if ( !aCtx.IsNull() ) {
- UpdateZLayersOfHilightPresentationsOfDisplayedObjects( aCtx, Graphic3d_ZLayerId_TopOSD );
- aCtx->UpdateCurrentViewer();
- }
-
- commitDocOperation();
-
- for (size_t i = 0; i < mySHPObjects.size(); i++ )
- free (mySHPObjects[i]);
-
- mySHPObjects.clear();
- SHPClose(aHSHP);
- }
-
-}
-
-void HYDROGUI_ImportLandCoverOp::onSelectionChanged( const QStringList& theSelectedNames )
-{
- Handle(AIS_InteractiveContext) aCtx = NULL;
-
- OCCViewer_ViewManager* aViewManager = getPreviewManager();
- if ( aViewManager ) {
- if ( OCCViewer_Viewer* aViewer = aViewManager->getOCCViewer() ) {
- aCtx = aViewer->getAISContext();
- }
- }
-
- if ( !aCtx.IsNull() ) {
- foreach ( QString aName, myPolygonName2PrsShape.keys() ) {
- Handle(AIS_InteractiveObject) anObject =
- myPolygonName2PrsShape.value(aName)->getAISObject();
-
- bool isSelected = theSelectedNames.contains( aName );
- if ( ( isSelected && !aCtx->IsSelected( anObject) ) ||
- ( !isSelected && aCtx->IsSelected( anObject) ) ) {
- aCtx->AddOrRemoveSelected( anObject, Standard_False );
- }
- }
- aCtx->UpdateCurrentViewer();
- }
-}
-
-
-void HYDROGUI_ImportLandCoverOp::onViewerSelectionChanged()
-{
- // Get panel
- HYDROGUI_ImportLandCoverDlg* aPanel = ::qobject_cast<HYDROGUI_ImportLandCoverDlg*>( inputPanel() );
- if ( !aPanel ) {
- return;
- }
-
- OCCViewer_ViewManager* aViewManager = getPreviewManager();
- Handle(AIS_InteractiveContext) aCtx = NULL;
- if ( aViewManager ) {
- if ( OCCViewer_Viewer* aViewer = aViewManager->getOCCViewer() ) {
- aCtx = aViewer->getAISContext();
- }
- }
-
- if ( !aCtx.IsNull() )
- {
- QStringList aSelectedNames;
- foreach ( QString aName, myPolygonName2PrsShape.keys() ) {
- bool isSelected = aCtx->IsSelected( myPolygonName2PrsShape.value(aName)->getAISObject() );
- if ( isSelected ) {
- aSelectedNames << aName;
- }
- }
- aPanel->setSelectedPolygonNames( aSelectedNames );
- }
-}
-
-
-void HYDROGUI_ImportLandCoverOp::erasePreview()
-{
- foreach ( HYDROGUI_Shape* aShape, myPolygonName2PrsShape ) {
- delete aShape;
- }
-
- myPolygonName2PrsShape.clear();
-}
-
-
-void HYDROGUI_ImportLandCoverOp::abortOperation()
-{
- LightApp_Application* anApp = module()->getApp();
- if ( anApp ) {
- anApp->disconnect( this );
- }
-
- erasePreview();
-
- HYDROGUI_Operation::abortOperation();
-}
-
-
+++ /dev/null
-// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-#ifndef HYDROGUI_IMPORTLANDCOVER_H
-#define HYDROGUI_IMPORTLANDCOVER_H
-
-#include "HYDROGUI_Operation.h"
-#include <vector>
-#include <QMap>
-
-//extern "C" {
-#include <shapelib/shapefil.h>
-//};
-
-class SUIT_FileDlg;
-class HYDROGUI_Shape;
-class TopoDS_Face;
-
-
-class HYDROGUI_ImportLandCoverOp : public HYDROGUI_Operation
-{
- Q_OBJECT
-
-public:
- HYDROGUI_ImportLandCoverOp( HYDROGUI_Module* theModule );
- virtual ~HYDROGUI_ImportLandCoverOp();
-
-protected:
- virtual void startOperation();
- virtual void abortOperation();
-
- virtual bool processApply( int& theUpdateFlags, QString& theErrorMsg, QStringList& theBrowseObjectsEntries );
- HYDROGUI_InputPanel* createInputPanel() const;
- void Parse(SHPHandle theHandle);
- void ProcessSHP(SHPObject* anObj, int i, TopoDS_Face& F);
- void erasePreview();
-
-protected slots:
- void onFileSelected();
- void onSelectionChanged( const QStringList& theSelectedNames );
- void onViewerSelectionChanged ();
-
-private:
- std::vector<SHPObject*> mySHPObjects;
- QMap<QString, HYDROGUI_Shape*> myPolygonName2PrsShape;
-};
-
-#endif
#include <QApplication>
#include <QFile>
#include <QFileInfo>
-#include <QMessageBox>
+#include <SUIT_MessageBox.h>
HYDROGUI_ImportPolylineOp::HYDROGUI_ImportPolylineOp( HYDROGUI_Module* theModule )
return;
}
- QString aFileName = myFileDlg->selectedFile();
- if ( aFileName.isEmpty() )
+ QStringList aFileNames = myFileDlg->selectedFiles();
+
+ QApplication::setOverrideCursor( Qt::WaitCursor );
+ startDocOperation();
+
+ foreach (QString aFileName, aFileNames)
{
- abort();
- return;
- }
+ if ( aFileName.isEmpty() )
+ continue;
- QString anExt = aFileName.split('.', QString::SkipEmptyParts).back();
+ QString anExt = aFileName.split('.', QString::SkipEmptyParts).back();
- if (anExt == "shp")
- {
- SHPHandle aHSHP;
- aHSHP = SHPOpen( aFileName.toAscii().data(), "rb" );
- Parse(aHSHP);
-
- QApplication::setOverrideCursor( Qt::WaitCursor );
-
- startDocOperation();
+ if (anExt == "shp")
+ {
+ SHPHandle aHSHP;
+ aHSHP = SHPOpen( aFileName.toAscii().data(), "rb" );
+ Parse(aHSHP);
- HYDROData_Iterator anIter( doc() );
- int anInd = 0;
- QStringList anExistingNames;
- std::vector<int> anAllowedIndexes;
- for( ; anIter.More(); anIter.Next() )
- anExistingNames.push_back(anIter.Current()->GetName());
+ HYDROData_Iterator anIter( doc() );
+ int anInd = 0;
+ QStringList anExistingNames;
+ std::vector<int> anAllowedIndexes;
+ for( ; anIter.More(); anIter.Next() )
+ anExistingNames.push_back(anIter.Current()->GetName());
- QFileInfo aFileInfo(aFileName);
- QString aBaseFileName = aFileInfo.baseName();
+ QFileInfo aFileInfo(aFileName);
+ QString aBaseFileName = aFileInfo.baseName();
- if (aHSHP->nShapeType == 3 || aHSHP->nShapeType == 23)
- {
- anInd = 0;
- for (;anAllowedIndexes.size() < mySHPObjects.size();)
+ if (aHSHP->nShapeType == 3 || aHSHP->nShapeType == 23)
{
- if (!anExistingNames.contains(aBaseFileName + "_PolyXY_" + QString::number(anInd)))
+ anInd = 0;
+ for (;anAllowedIndexes.size() < mySHPObjects.size();)
{
- anAllowedIndexes.push_back(anInd);
- anInd++;
+ if (!anExistingNames.contains(aBaseFileName + "_PolyXY_" + QString::number(anInd)))
+ {
+ anAllowedIndexes.push_back(anInd);
+ anInd++;
+ }
+ else
+ anInd++;
+ }
+
+ for (size_t i = 0; i < mySHPObjects.size(); i++ )
+ {
+ ProcessSHPPolyXY(mySHPObjects[i], aBaseFileName, anAllowedIndexes[i]);
}
- else
- anInd++;
- }
-
- for (size_t i = 0; i < mySHPObjects.size(); i++ )
- {
- ProcessSHPPolyXY(mySHPObjects[i], aBaseFileName, anAllowedIndexes[i]);
}
- }
- else if (aHSHP->nShapeType == 13)
- {
- anInd = 0;
- for (;anAllowedIndexes.size() < mySHPObjects.size();)
+ else if (aHSHP->nShapeType == 13)
{
- if (!anExistingNames.contains(aBaseFileName + "_PolyXY_" + QString::number(anInd)) &&
- !anExistingNames.contains(aBaseFileName + "_Poly3D_" + QString::number(anInd)) &&
- !anExistingNames.contains(aBaseFileName + "_Bath_" + QString::number(anInd)))
+ anInd = 0;
+ for (;anAllowedIndexes.size() < mySHPObjects.size();)
{
- anAllowedIndexes.push_back(anInd);
- anInd++;
+ if (!anExistingNames.contains(aBaseFileName + "_PolyXY_" + QString::number(anInd)) &&
+ !anExistingNames.contains(aBaseFileName + "_Poly3D_" + QString::number(anInd)) &&
+ !anExistingNames.contains(aBaseFileName + "_Bath_" + QString::number(anInd)))
+ {
+ anAllowedIndexes.push_back(anInd);
+ anInd++;
+ }
+ else
+ anInd++;
}
- else
- anInd++;
+ for (size_t i = 0; i < mySHPObjects.size(); i++ )
+ ProcessSHPPoly3D(mySHPObjects[i], aBaseFileName, anAllowedIndexes[i]);
}
+ else
+ {
+ SUIT_MessageBox::warning( module()->getApp()->desktop(), tr( "IMPORT_POLYLINE" ), "Cannot import polyline;\nThe shape type is incorrect" );
+ }
+
for (size_t i = 0; i < mySHPObjects.size(); i++ )
- ProcessSHPPoly3D(mySHPObjects[i], aBaseFileName, anAllowedIndexes[i]);
+ free (mySHPObjects[i]);
+
+ mySHPObjects.clear();
+ SHPClose(aHSHP);
}
+ }
+ if (!aFileNames.empty())
+ {
commitDocOperation();
commit();
-
- for (size_t i = 0; i < mySHPObjects.size(); i++ )
- free (mySHPObjects[i]);
-
- mySHPObjects.clear();
- SHPClose(aHSHP);
+ module()->update( UF_Model | UF_VTKViewer | UF_VTK_Forced | UF_VTK_Init );
}
- module()->update( UF_Model | UF_VTKViewer | UF_VTK_Forced | UF_VTK_Init );
+ else
+ abort();
QApplication::restoreOverrideCursor();
}
#include <HYDROGUI_MergePolylinesDlg.h>
#include <HYDROGUI_ObjListBox.h>
#include <QFrame>
+#include <QLabel>
#include <QGridLayout>
+#include <QLineEdit>
HYDROGUI_MergePolylinesDlg::HYDROGUI_MergePolylinesDlg( HYDROGUI_Module* theModule, const QString& theTitle )
: HYDROGUI_InputPanel( theModule, theTitle )
aLayout->setMargin( 5 );
aLayout->setSpacing( 5 );
+ myName = new QLineEdit( mainFrame() );
+ aLayout->addWidget( new QLabel( tr( "RESULT_NAME" ) ), 0, 0 );
+ aLayout->addWidget( myName, 0, 1 );
+
myList = new HYDROGUI_ObjListBox( theModule, tr( "POLYLINES" ), KIND_POLYLINEXY, mainFrame() );
- aLayout->addWidget( myList, 0, 0 );
+ aLayout->addWidget( myList, 1, 0, 1, 2 );
}
HYDROGUI_MergePolylinesDlg::~HYDROGUI_MergePolylinesDlg()
{
return myList->setObjectsFromSelection();
}
+
+QString HYDROGUI_MergePolylinesDlg::GetResultName() const
+{
+ return myName->text();
+}
#include <HYDROGUI_InputPanel.h>
#include <HYDROData_Entity.h>
+class QLineEdit;
class HYDROGUI_ObjListBox;
class HYDROGUI_MergePolylinesDlg : public HYDROGUI_InputPanel
HYDROGUI_MergePolylinesDlg( HYDROGUI_Module* theModule, const QString& theTitle );
virtual ~HYDROGUI_MergePolylinesDlg();
+ QString GetResultName() const;
HYDROData_SequenceOfObjects selectedPolylines() const;
void setSelectedPolylines( const HYDROData_SequenceOfObjects& );
void setPolylinesFromSelection();
private:
+ QLineEdit* myName;
HYDROGUI_ObjListBox* myList;
};
#include <HYDROGUI_MergePolylinesOp.h>
#include <HYDROGUI_MergePolylinesDlg.h>
#include <HYDROGUI_UpdateFlags.h>
+#include <HYDROData_Document.h>
#include <HYDROData_PolylineOperator.h>
HYDROGUI_MergePolylinesOp::HYDROGUI_MergePolylinesOp( HYDROGUI_Module* theModule )
if ( !aPanel )
return false;
+ QString aName = aPanel->GetResultName();
HYDROData_SequenceOfObjects aPolylinesList = aPanel->selectedPolylines();
HYDROData_PolylineOperator anOp;
- anOp.Merge( aPolylinesList );
+ anOp.Merge( doc(), aName.toLatin1().data(), aPolylinesList );
theUpdateFlags = UF_Model | UF_OCCViewer | UF_OCC_Forced | UF_VTKViewer;
return true;
theMenu->addAction( action( DuplicateStricklerTableId ) );
theMenu->addSeparator();
- if ( !isLandCoversScalarMapModeOn( anActiveViewId ) &&
- !getObjectShapes( anActiveViewId, KIND_LAND_COVER ).isEmpty() ) {
+ Handle(HYDROData_StricklerTable) aTable =
+ Handle(HYDROData_StricklerTable)::DownCast( aSeq.First() );
+ QString aCurrentTable =
+ HYDROGUI_DataObject::dataObjectEntry( getLandCoverColoringTable( anActiveViewId ) );
+ bool isUsed = aCurrentTable == HYDROGUI_DataObject::dataObjectEntry( aTable );
+
+ if ( !isUsed && !getObjectShapes( anActiveViewId, KIND_LAND_COVER ).isEmpty() ) {
theMenu->addAction( action( LandCoverScalarMapModeOnId ) );
theMenu->addSeparator();
}
theMenu->addSeparator();
}
- if (anIsPolyline || anIsPolyline3D)
- theMenu->addAction( action( ExportPolylineId ) );
+ bool anIsPoly = anIsPolyline || anIsPolyline3D;
+ if ((anIsPoly && !anIsLandCover) || (!anIsPoly && anIsLandCover))
+ theMenu->addAction( action( ExportToShapeFileID ) );
// Add copy action
QAction* aCopyAction = action( CopyId );
{
return myLandCoverColoringMap.contains( theViewId );
}
+
+void HYDROGUI_Module::setObjectRemoved( const Handle(HYDROData_Entity)& theObject )
+{
+ if ( theObject.IsNull() || !theObject->IsRemoved() ) {
+ return;
+ }
+
+ if ( theObject->GetKind() == KIND_STRICKLER_TABLE ) {
+ Handle(HYDROData_StricklerTable) aTable =
+ Handle(HYDROData_StricklerTable)::DownCast( theObject );
+ QList<int> aViewIds;
+ QMutableMapIterator<int, Handle(HYDROData_StricklerTable)> anIter( myLandCoverColoringMap );
+ while ( anIter.hasNext() ) {
+ if ( HYDROGUI_DataObject::dataObjectEntry( anIter.next().value() ) ==
+ HYDROGUI_DataObject::dataObjectEntry( aTable ) ) {
+ anIter.remove();
+ }
+ }
+ }
+}
*/
bool isLandCoversScalarMapModeOn( const int theViewId ) const;
+ /**
+ * Set object as removed.
+ * @param theObject the removed object
+ */
+ void setObjectRemoved( const Handle(HYDROData_Entity)& theObject );
+
protected:
CAM_DataModel* createDataModel();
OCCViewer_ViewWindow* aWnd = dynamic_cast<OCCViewer_ViewWindow*>( theViewer->getViewManager()->getActiveView() );
Handle(V3d_View) aView = aWnd->getViewPort()->getView();
-
+
int aViewerId = (size_t)theViewer;//TODO: check if viewer id is correct
bool isLandCoverColoringOn = module()->isLandCoversScalarMapModeOn( aViewerId );
if ( isLandCoverColoringOn ) {
aTable = module()->getLandCoverColoringTable( aViewerId );
if ( !aTable.IsNull() ) {
- aColorScaleTitle = TCollection_ExtendedString( aTable->GetName().toLatin1().constData() );
+ // TODO: non-empty title leads to buggy behaviour
+ // aColorScaleTitle = TCollection_ExtendedString( aTable->GetName().toLatin1().constData() );
aTable->GetCoefficientRange( aColorScaleMin, aColorScaleMax );
aTableTypes = aTable->GetTypes();
}
aLandCoverShape->setFillingColor( aColor, true, true );
aLandCoverShape->setScalarMapModeEnabled( isLandCoverColoringOn );
theViewer->getAISContext()->Redisplay( aLandCoverShape->getAISObject() );
- //theViewer->getAISContext()->UpdateCurrentViewer(); //@MZN
- //theViewer->getAISContext()->UpdateCurrent();
- //theViewer->getAISContext()->UpdateSelected( true );
}
myToUpdateColorScale = false;
createAction( ProfileInterpolateId, "PROFILE_INTERPOLATE", "PROFILE_INTERPOLATE_ICO" );
createAction( SubmersibleId, "SUBMERSIBLE", "SUBMERSIBLE_ICO" );
- createAction( ExportPolylineId, "EXPORT_POLYLINE", "EXPORT_POLYLINE_ICO" );
+ createAction( ExportToShapeFileID, "EXPORT_TO_SHAPE_FILE", "EXPORT_TO_SHAPE_FILE_ICO" );
createAction( SplitPolylinesId, "SPLIT_POLYLINES", "SPLIT_POLYLINES_ICO" );
createAction( MergePolylinesId, "MERGE_POLYLINES", "MERGE_POLYLINES_ICO" );
case ForcedUpdateObjectId:
anOp = new HYDROGUI_UpdateObjectOp( aModule, theId == ForcedUpdateObjectId );
break;
- case ExportPolylineId:
+ case ExportToShapeFileID:
anOp = new HYDROGUI_ExportFileOp( aModule );
break;
case ImportLandcoverId:
ImportSinusXId,
ExportSinusXId,
- ExportPolylineId,
+ ExportToShapeFileID,
ImportLandcoverId,
ImportStricklerTableFromFileId,
#include <QGridLayout>
#include <QTabWidget>
#include <QMouseEvent>
+#include <QLineEdit>
#include <gp_Pnt2d.hxx>
const double MIN_COORD = -1000000;
aLayout->setMargin( 5 );
aLayout->setSpacing( 5 );
+ myName = new QLineEdit( mainFrame() );
+ aLayout->addWidget( new QLabel( tr( "RESULT_NAME" ) ), 0, 0 );
+ aLayout->addWidget( myName, 0, 1 );
+
myTab = new QTabWidget( aFrame );
- aLayout->addWidget( myTab, 0, 0 );
+ aLayout->addWidget( myTab, 1, 0, 1, 2 );
QFrame* aPointPage = new QFrame();
myMainPolyline1 = new HYDROGUI_ObjComboBox( theModule, tr( "POLYLINE" ), KIND_POLYLINEXY, aPointPage );
return aViewPort;
}
+
+QString HYDROGUI_SplitPolylinesDlg::GetResultName() const
+{
+ return myName->text();
+}
class OCCViewer_Viewer;
class SUIT_ViewWindow;
class OCCViewer_ViewPort3d;
+class QLineEdit;
class HYDROGUI_SplitPolylinesDlg : public HYDROGUI_InputPanel
{
HYDROGUI_SplitPolylinesDlg( HYDROGUI_Module* theModule, const QString& theTitle );
virtual ~HYDROGUI_SplitPolylinesDlg();
- Mode GetMode() const;
+ QString GetResultName() const;
+ Mode GetMode() const;
Handle( HYDROData_PolylineXY ) GetMainPolyline() const;
Handle( HYDROData_PolylineXY ) GetToolPolyline() const;
- gp_Pnt2d GetPoint() const;
- HYDROData_SequenceOfObjects GetPolylines() const;
+ gp_Pnt2d GetPoint() const;
+ HYDROData_SequenceOfObjects GetPolylines() const;
void setPolylinesFromSelection();
void setOCCViewer( OCCViewer_Viewer* theViewer );
OCCViewer_ViewPort3d* getViewPort() const;
private:
- QTabWidget* myTab;
- QtxDoubleSpinBox* myX;
- QtxDoubleSpinBox* myY;
+ QLineEdit* myName;
+ QTabWidget* myTab;
+ QtxDoubleSpinBox* myX;
+ QtxDoubleSpinBox* myY;
HYDROGUI_ObjComboBox* myMainPolyline1;
HYDROGUI_ObjComboBox* myMainPolyline2;
HYDROGUI_ObjComboBox* myToolPolyline;
#include <HYDROGUI_UpdateFlags.h>
#include <HYDROGUI_Shape.h>
#include <HYDROData_PolylineOperator.h>
+#include <HYDROData_Document.h>
#include <LightApp_Application.h>
#include <OCCViewer_ViewModel.h>
#include <OCCViewer_ViewManager.h>
if ( !aPanel )
return false;
+ QString aName = aPanel->GetResultName();
Handle( HYDROData_PolylineXY ) aMainPolyline = aPanel->GetMainPolyline();
Handle( HYDROData_PolylineXY ) aToolPolyline = aPanel->GetToolPolyline();
HYDROData_SequenceOfObjects aPolylinesList = aPanel->GetPolylines();
switch( aPanel->GetMode() )
{
case HYDROGUI_SplitPolylinesDlg::ByPoint:
- anOp.Split( aMainPolyline, aPoint );
+ anOp.Split( doc(), aName.toLatin1().data(), aMainPolyline, aPoint );
break;
case HYDROGUI_SplitPolylinesDlg::ByTool:
- anOp.Split( aMainPolyline, aToolPolyline );
+ anOp.Split( doc(), aName.toLatin1().data(), aMainPolyline, aToolPolyline );
break;
case HYDROGUI_SplitPolylinesDlg::Split:
- anOp.Split( aPolylinesList );
+ anOp.Split( doc(), aName.toLatin1().data(), aPolylinesList );
break;
}
</message>
<message>
- <source>EXPORT_POLYLINE_ICO</source>
- <translation>icon_export_polyline.png</translation>
+ <source>EXPORT_TO_SHAPE_FILE_ICO</source>
+ <translation>icon_export_shp.png</translation>
</message>
<message>
<translation>Submersible</translation>
</message>
<message>
- <source>DSK_EXPORT_POLYLINE</source>
- <translation>Export Polyline</translation>
+ <source>DSK_EXPORT_TO_SHAPE_FILE</source>
+ <translation>Export to Shape file</translation>
</message>
<message>
<source>MEN_CREATE_CALCULATION</source>
<translation>Submersible</translation>
</message>
<message>
- <source>MEN_EXPORT_POLYLINE</source>
- <translation>Export Polyline</translation>
+ <source>MEN_EXPORT_TO_SHAPE_FILE</source>
+ <translation>Export to Shape file</translation>
</message>
<message>
<translation>If the object is submersible</translation>
</message>
<message>
- <source>STB_EXPORT_POLYLINE</source>
- <translation>Export Polyline</translation>
+ <source>STB_EXPORT_TO_SHAPE_FILE</source>
+ <translation>Export to Shape file</translation>
</message>
<context>
<name>HYDROGUI_ExportFileOp</name>
<message>
- <source>EXPORT_POLYLINE</source>
- <translation>Export polyline</translation>
+ <source>EXPORT_TO_SHAPE_FILE</source>
+ <translation>Export to Shape file</translation>
+ </message>
+ <message>
+ <source>SHP_FILTER</source>
+ <translation>Shape Files (*.shp)</translation>
</message>
</context>
<source>COMPLETE_SPLIT</source>
<translation>Complete split</translation>
</message>
+ <message>
+ <source>RESULT_NAME</source>
+ <translation>Result name prefix:</translation>
+ </message>
</context>
<context>
<source>MERGE_POLYLINES</source>
<translation>Merge polylines</translation>
</message>
+ <message>
+ <source>RESULT_NAME</source>
+ <translation>Result name:</translation>
+ </message>
</context>
<context>