TDF_CopyLabel aCopy(myLab, theDestination->Label());
aCopy.Perform();
--
++
if( isGenerateNewName )
{
// generate a new unique name for the clone object:
return false;
}
-void HYDROData_Entity::SetZLevel( const Standard_Integer& theLevel )
+void HYDROData_Entity::SetZLevel( int theLevel )
{
- TDataStd_Integer::Set( myLab.FindChild( DataTag_ZLevel ), theLevel );
+ Handle(TDataStd_Integer) A = TDataStd_Integer::Set( myLab.FindChild( DataTag_ZLevel ), theLevel );
+ A->SetID(TDataStd_Integer::GetID());
}
void HYDROData_Entity::RemoveZLevel()
void HYDROData_Entity::SetLabel( const TDF_Label& theLabel )
{
- myLab = theLabel;
+ myLab = theLabel;
}
--void HYDROData_Entity::SaveByteArray( const int theTag,
++void HYDROData_Entity::SaveByteArray( const int theTag,
const char* theData,
const int theLen )
{
for(int a = 0; a < theLen; a++)
aNewData->SetValue(a + 1, theData[a]);
aData->ChangeArray(aNewData);
- } else {
- for(int a = 0; a < theLen; a++)
- aData->SetValue(a + 1, theData[a]);
- }
++ }
+ else
+ {
+ // for(int a = 0; a < theLen; a++)
+ // aData->SetValue(a + 1, theData[a]);
}
}
aRefs = getReferenceList( theTag, true ); // because reference list can be removed
if ( !aBeforeObj.IsNull() )
aRefs->InsertBefore( theObj->Label(), aBeforeObj->Label() );
-- else
++ else
aRefs->Append( theObj->Label() );
}
}
Handle(HYDROData_Entity) aBeforeObj = GetReferenceObject( theTag, theBeforeIndex );
if ( !aBeforeObj.IsNull() )
aRefs->InsertBefore( theObj->Label(), aBeforeObj->Label() );
-- else
++ else
aRefs->Append( theObj->Label() );
}
}
return;
if ( aRefs->Extent() == 1 )
-- {
++ {
// remove all if only one
ClearReferenceObjects( theTag );
return;
return;
if ( aRefs->Extent() == 1 && theIndex == 0 )
-- {
++ {
// remove all if only one
ClearReferenceObjects( theTag );
return;
return anAttr->Get();
}
-bool HYDROData_Entity::CompareLabels(const Handle(HYDROData_Entity)& theOtherObj)
+
+ void HYDROData_Entity::SetInteger( int theTag, int theValue )
+ {
+ Handle(TDataStd_Integer) anAttr;
+ TDF_Label aLabel = myLab.FindChild( theTag );
+ if( !aLabel.FindAttribute( TDataStd_Integer::GetID(), anAttr ) )
+ {
+ anAttr = new TDataStd_Integer();
+ anAttr->SetID(TDataStd_Integer::GetID());
+ aLabel.AddAttribute(anAttr);
+ }
+ anAttr->Set( theValue );
+ }
+
+ int HYDROData_Entity::GetInteger( int theTag, int theDefValue ) const
+ {
+ Handle(TDataStd_Integer) anAttr;
+ TDF_Label aLabel = myLab.FindChild( theTag );
+ if( !aLabel.FindAttribute( TDataStd_Integer::GetID(), anAttr ) )
+ return theDefValue;
+
+ return anAttr->Get();
+ }
+
-}
++bool HYDROData_Entity::CompareLabels(const Handle(HYDROData_Entity)& theOtherObj)
+ {
+ if ( !theOtherObj.IsNull() )
+ return this->Label() == theOtherObj->Label();
+ return false;
++}
+
* \brief Generic class of any object in the data model.
*
* Interface for getting access to the object that belong to the data model.
-- * Managed by Document. Provides access to the common properties:
++ * Managed by Document. Provides access to the common properties:
* kind of an object, name.
*/
class HYDROData_Entity : public MMgt_TShared
/**
* Returns flag indicating that object can be removed or not.
-- * Reimplement this method in class which can't be removed
++ * Reimplement this method in class which can't be removed
* separately with it parent object.
* Base implementaiton returns always TRUE.
*/
* \param theDefColor default color to return if attribute has not been set before
*/
HYDRODATA_EXPORT QColor GetColor( const QColor& theDefColor, const int theTag = 0 ) const;
-
+
+ /* Internal method that used to retreive the color attribute
+ * \param theTag tag of a label that keeps the attribute (for 0 this is myLab)
+ * \param theOutColor color to return if attribute has been set before
+ * \return true if attribute is present
+ */
+ HYDRODATA_EXPORT bool GetColor( QColor& theOutColor,
+ const int theTag ) const;
-
++
protected:
friend class HYDROData_Iterator;
/**
-- * Creates new object in the internal data structure. Use higher level objects
++ * Creates new object in the internal data structure. Use higher level objects
* to create objects with real content.
*/
HYDRODATA_EXPORT HYDROData_Entity( Geometry );
* Internal method that used to retreive the content of byte array attribute
* \param theTag tag of a label that keeps the attribute (for 0 this is myLab)
* \param theLen number of bytes in byte array
-- * \returns pointer to the internal data structure wit harray content,
++ * \returns pointer to the internal data structure wit harray content,
* or NULL if array size is zero
*/
const char* ByteArray(const int theTag, int& theLen) const;
* Internal method that used to store the reference object label attribute
* \param theObj pointer to reference object
* \param theTag tag of a label to store attribute (for 0 this is myLab)
-- * \param theIndex index in the list of references
++ * \param theIndex index in the list of references
- if more that len then just append it to the end of list
- if less than zero then prepend to the list
- indexing starts from 0
* Internal method that used to store the reference object label attribute
* \param theObj pointer to reference object
* \param theTag tag of a label to store attribute (for 0 this is myLab)
-- * \param theBeforeIndex index in the list of references
++ * \param theBeforeIndex index in the list of references
- if more that len then just append it to the end of list
- if less than zero then prepend to the list
- indexing starts from 0
/**
* Internal method that used to retreive the reference object(s) attribute
* \param theTag tag of a label that keeps the attribute (for 0 this is myLab)
-- * \param theIndex index in the list of references
++ * \param theIndex index in the list of references
* - indexing starts from 0
* \returns pointer to reference object or NULL if label is not set
*/
/**
* Internal method that used to remove the reference object attribute
* \param theTag tag of a label that keeps the attribute (for 0 this is myLab)
-- * \param theIndex index in the list of references
++ * \param theIndex index in the list of references
* - indexing starts from 0
*/
void RemoveReferenceObject( const int theTag = 0, const int theIndex = 0 );
* \param theTag tag of a label that keeps the attribute (for 0 this is myLab)
*/
void ClearReferenceObjects( const int theTag = 0 );
-
+
+ public:
+
+ HYDRODATA_EXPORT virtual bool CompareLabels(const Handle(HYDROData_Entity)& theOtherObj);
-
++
protected:
/**
* Dump the initial object creation to a Python script.
-- * You should call it from DumpToPython implementation before
++ * You should call it from DumpToPython implementation before
* dumping fields of the object.
*/
HYDRODATA_EXPORT virtual QStringList dumpObjectCreation( MapOfTreatedObjects& theTreatedObjects ) const;
Handle(TDataStd_ReferenceList) getReferenceList( const int theTag,
const bool theIsCreate ) const;
--
++
void SetShape( int theTag, const TopoDS_Shape& theShape );
TopoDS_Shape GetShape( int theTag ) const;
HYDRODATA_EXPORT bool Add( const Handle( HYDROData_Object )&, const QString& theType );
HYDRODATA_EXPORT bool Add( const Handle( HYDROData_PolylineXY )&, const QString& theType );
+ using HYDROData_Entity::Remove;
HYDRODATA_EXPORT bool Remove( const TopoDS_Face& );
HYDRODATA_EXPORT bool Remove( const TopTools_ListOfShape& );
+ using HYDROData_Entity::Remove;
HYDRODATA_EXPORT bool Split( const Handle( HYDROData_PolylineXY )& );
HYDRODATA_EXPORT bool Split( const TopoDS_Shape& );
#pragma warning( disable: 4996 )
#endif
--//SHP->TFaces (Import)
++//SHP->TFaces (Import)
#define OSD_TIMER
HYDROData_ShapeFile::HYDROData_ShapeFile() : myHSHP(NULL)
--{
++{
}
HYDROData_ShapeFile::~HYDROData_ShapeFile()
SHPHandle hSHPHandle;
if (!aPolyXYSeq.IsEmpty() && aPoly3DSeq.IsEmpty())
{
-- hSHPHandle = SHPCreate( aFileName.toLatin1().data(), SHPT_ARC );
++ hSHPHandle = SHPCreate( aFileName.toLatin1().data(), SHPT_ARC );
for (int i = 1; i <= aPolyXYSeq.Size(); i++)
- if (WriteObjectPolyXY(hSHPHandle, aPolyXYSeq(i)) != 1)
+ if (WriteObjectPolyXY(theDocument, hSHPHandle, aPolyXYSeq(i)) != 1)
aNonExpList.append(aPolyXYSeq(i)->GetName());
}
else if (aPolyXYSeq.IsEmpty() && !aPoly3DSeq.IsEmpty())
SHPObject *aSHPObj;
std::vector<double> x, y;
std::vector<int> anPartStart;
--
-- for (int i = 0; i < thePoly->NbSections(); i++)
++
++ for (int i = 0; i < thePoly->NbSections(); i++)
if (thePoly->GetSectionType(i) == HYDROData_IPolyline::SECTION_SPLINE)
return -1;
}
if (thePoly->IsClosedSection(i))
{
- x.push_back( aPointList(1).X());
- y.push_back( aPointList(1).Y());
+ gp_XY P = aPointList(1);
+ //theDocument->Transform(P, false);
+ x.push_back( P.X());
+ y.push_back( P.Y());
}
}
--
- aSHPObj = SHPCreateObject( SHPT_ARC, -1, thePoly->NbSections(), &anPartStart[0], NULL, x.size(), &x[0], &y[0], NULL, NULL );
++
+ aSHPObj = SHPCreateObject (SHPT_ARC, -1, thePoly->NbSections(), &anPartStart[0], NULL, x.size(), &x[0], &y[0], NULL, NULL );
SHPWriteObject( theShpHandle, -1, aSHPObj );
SHPDestroyObject( aSHPObj );
return 1;
}
- int HYDROData_ShapeFile::WriteObjectPoly3D(SHPHandle theShpHandle, Handle_HYDROData_Polyline3D thePoly )
+ int HYDROData_ShapeFile::WriteObjectPoly3D(Handle(HYDROData_Document) theDocument,
+ SHPHandle theShpHandle,
+ Handle(HYDROData_Polyline3D) thePoly )
{
- SHPObject *aSHPObj;
+ SHPObject *aSHPObj;
std::vector<double> x, y, z;
std::vector<int> anPartStart;
+ anPartStart.push_back(0); //one section only
- for (int i = 0; i < thePoly->GetPolylineXY()->NbSections(); i++)
- if (thePoly->GetPolylineXY()->GetSectionType(i) == HYDROData_IPolyline::SECTION_SPLINE)
- return -1;
-
- for (int i = 0; i < thePoly->GetPolylineXY()->NbSections(); i++)
- {
- anPartStart.push_back(x.size());
- HYDROData_PolylineXY::PointsList aPointList = thePoly->GetPolylineXY()->GetPoints(i);
- for (int j = 1; j <= aPointList.Size(); j++)
- {
- x.push_back( aPointList(j).X());
- y.push_back( aPointList(j).Y());
- z.push_back(thePoly->GetAltitudeObject()->GetAltitudeForPoint(gp_XY (aPointList(j).X(), aPointList(j).Y())));
- }
- if ( thePoly->GetPolylineXY()->IsClosedSection(i))
- {
- x.push_back( aPointList(1).X());
- y.push_back( aPointList(1).Y());
- z.push_back(thePoly->GetAltitudeObject()->GetAltitudeForPoint(gp_XY (aPointList(1).X(), aPointList(1).Y())));
+ if (thePoly->GetPolylineXY()->GetSectionType(0) == HYDROData_IPolyline::SECTION_SPLINE)
- return -1;
++ return -1;
- }
+ HYDROData_Polyline3D::Polyline3DPoints aPointList3D = thePoly->GetProfilePoints3D(true);
+ for (int j = 1; j <= aPointList3D.Size(); j++)
+ {
+ const gp_XYZ& P = aPointList3D(j);
+ //theDocument->Transform(P, false);
+ x.push_back(P.X());
+ y.push_back(P.Y());
+ z.push_back(P.Z());
}
-
- aSHPObj = SHPCreateObject( SHPT_ARCZ, -1, thePoly->GetPolylineXY()->NbSections(), &anPartStart[0], NULL, x.size(), &x[0], &y[0], &z[0], NULL );
+ if ( thePoly->GetPolylineXY()->IsClosedSection(0))
+ {
+ const gp_XYZ& P = aPointList3D(1);
+ //theDocument->Transform(P, false);
+ x.push_back(P.X());
+ y.push_back(P.Y());
+ z.push_back(P.Z());
+ }
+
+ aSHPObj = SHPCreateObject( SHPT_ARCZ, -1, 1, &anPartStart[0], NULL, x.size(), &x[0], &y[0], &z[0], NULL );
SHPWriteObject( theShpHandle, -1, aSHPObj );
SHPDestroyObject( aSHPObj );
return 1;
else if (theInputShape.ShapeType() == TopAbs_COMPOUND)
{
TopExp_Explorer Ex(theInputShape, TopAbs_FACE);
-- for (; Ex.More(); Ex.Next())
++ for (; Ex.More(); Ex.Next())
{
-- TopoDS_Face aF = TopoDS::Face(Ex.Current());
++ TopoDS_Face aF = TopoDS::Face(Ex.Current());
if (aF.IsNull())
continue;
- ProcessFace(aF, theShpHandle, bUseDiscr, theDefl);
+ ProcessFace(theDocument, aF, theShpHandle, bUseDiscr, theDefl);
}
}
else
return 0;
return 1;
--
++
}
- void HYDROData_ShapeFile::ProcessFace(const TopoDS_Face& theFace, SHPHandle theShpHandle,
+ void HYDROData_ShapeFile::ProcessFace(Handle(HYDROData_Document) theDocument,
+ const TopoDS_Face& theFace,
+ SHPHandle theShpHandle,
bool bUseDiscr, double theDefl )
{
if (theFace.ShapeType() != TopAbs_FACE)
NCollection_Sequence<TopoDS_Wire> aWires;
//write an outer wire first
-- aWires.Append(OuterW);
-- TopExp_Explorer Ex(theFace, TopAbs_WIRE);
-- for (; Ex.More(); Ex.Next())
++ aWires.Append(OuterW);
++ TopExp_Explorer Ex(theFace, TopAbs_WIRE);
++ for (; Ex.More(); Ex.Next())
{
TopoDS_Wire aW = TopoDS::Wire(Ex.Current());
if (aW.IsEqual(OuterW))
continue;
-- aWires.Append(aW);
++ aWires.Append(aW);
}
int NbWires = 0;
-- for (int k = 1; k <= aWires.Length(); k++)
++ for (int k = 1; k <= aWires.Length(); k++)
{
-- TopoDS_Wire aW = aWires(k);
++ TopoDS_Wire aW = aWires(k);
if (aW.IsNull())
continue;
NbWires++;
if (aW.Orientation() == TopAbs_INTERNAL)
//cant write internal wires/edges
-- continue;
++ continue;
// Try to reorder edges
Handle(ShapeFix_Wire) aSFW = new ShapeFix_Wire( aW, theFace, Precision::Confusion() );
aSFW->ModifyTopologyMode() = Standard_False;
aNPnts.Append(aPnts.First());
for (int j = 1; j <= aPnts.Size() - 1; j++)
{
-- if (!aPnts(j).IsEqual(aPnts(j + 1), Precision::Confusion()))
++ if (!aPnts(j).IsEqual(aPnts(j + 1), Precision::Confusion()))
aNPnts.Append(aPnts(j + 1));
}
//External wire will be written in clockwise direction
//any other wires (holes) - in anticlockwise direction
for (int j = aNPnts.Size(); j >= 1; j--)
-- {
- x.push_back( aNPnts(j).X());
- y.push_back( aNPnts(j).Y());
++ {
+ gp_XY P = gp_XY(aNPnts(j).X(), aNPnts(j).Y());
+ theDocument->Transform(P, false);
+ x.push_back( P.X());
+ y.push_back( P.Y());
}
//first point is same as the last one => closed polygon
- x.push_back( aNPnts.Last().X());
- y.push_back( aNPnts.Last().Y());
+ gp_XY P = gp_XY(aNPnts.Last().X(), aNPnts.Last().Y());
+ theDocument->Transform(P, false);
+ x.push_back( P.X());
+ y.push_back( P.Y());
}
--
++
aSHPObj = SHPCreateObject( SHPT_POLYGON, -1, NbWires, &anPartStart[0], NULL, x.size(), &x[0], &y[0], NULL, NULL );
SHPWriteObject( theShpHandle, -1, aSHPObj );
SHPDestroyObject( aSHPObj );
int aShapeType;
mySHPObjects.clear();
SHPGetInfo( theHandle, NULL, &aShapeType, NULL, NULL );
- theShapeTypeOfFile = aShapeType;
- bool ToRead = (theType == ShapeType_Polyline && (aShapeType == 3 || aShapeType == 13 || aShapeType == 23)) ||
+ //theShapeTypeOfFile = aShapeType;
- bool ToRead = (theType == ShapeType_Polyline &&
++ bool ToRead = (theType == ShapeType_Polyline &&
+ (aShapeType == 3 || aShapeType == 13 || aShapeType == 23 || aShapeType == 5)) ||
(theType == ShapeType_Polygon && aShapeType == 5);
-- if (ToRead)
++ if (ToRead)
{
-- for (int i = 0; i < theHandle->nRecords; i++)
++ for (int i = 0; i < theHandle->nRecords; i++)
mySHPObjects.push_back(SHPReadObject(theHandle, i));
return true;
}
{
if (!anObj)
return;
-- TopoDS_Edge E;
++ TopoDS_Edge E;
int nParts = anObj->nParts;
- Handle_Geom_Plane aPlaneSur = new Geom_Plane(gp_Pnt(0,0,0), gp_Dir(0,0,1));
+ Handle(Geom_Plane) aPlaneSur = new Geom_Plane(gp_Pnt(0,0,0), gp_Dir(0,0,1));
BRep_Builder BB;
BB.MakeFace(F);
TopTools_SequenceOfShape aWires;
for ( int i = 0 ; i < nParts ; i++ )
-- {
++ {
BRepBuilderAPI_MakeWire aBuilder;
int StartIndex = anObj->panPartStart[i];
int EndIndex;
TopoDS_Wire W;
BB.MakeWire(W);
-- //First point is same as the last point
++ //First point is same as the last point
int NbPnts = EndIndex - StartIndex - 1;
NCollection_Array1<TopoDS_Vertex> VPoints(0, NbPnts);
int j = NbPnts;
VPoints.ChangeValue(j) = BRepLib_MakeVertex(P).Vertex();
j--;
}
--
++
for ( int k = 0; k < VPoints.Size() - 1; k++ )
{
gp_Pnt P1 = BRep_Tool::Pnt(VPoints(k));
Standard_Real jXmax, jXmin, jYmax, jYmin;
BBs(i).Get(iXmin, iYmin, z0, iXmax, iYmax, z1);
BBs(j).Get(jXmin, jYmin, z0, jXmax, jYmax, z1);
-- if (!(iXmin > jXmin &&
++ if (!(iXmin > jXmin &&
iYmin > jYmin &&
iXmax < jXmax &&
iYmax < jYmax))
BB.UpdateFace(DF, aPlaneSur, TopLoc_Location(), Precision::Confusion());
//
BRepTopAdaptor_FClass2d FClass(DF, Precision::PConfusion());
-- if ( i == OutWIndex && FClass.PerformInfinitePoint() == TopAbs_IN)
++ if ( i == OutWIndex && FClass.PerformInfinitePoint() == TopAbs_IN)
W.Reverse();
-- if ( i != OutWIndex && FClass.PerformInfinitePoint() == TopAbs_OUT)
++ if ( i != OutWIndex && FClass.PerformInfinitePoint() == TopAbs_OUT)
W.Reverse();
//
BB.Add(F, W);
}
--
++
//Add surface to the face
BB.UpdateFace(F, aPlaneSur, TopLoc_Location(), Precision::Confusion());
F.Closed(Standard_True);
}
- int HYDROData_ShapeFile::ImportPolygons(const QString theFileName, QStringList& thePolygonsList, TopTools_SequenceOfShape& theFaces, int& theShapeTypeOfFile)
-int HYDROData_ShapeFile::ImportPolygons(Handle(HYDROData_Document) theDocument, const QString theFileName,
++int HYDROData_ShapeFile::ImportPolygons(Handle(HYDROData_Document) theDocument, const QString theFileName,
+ QStringList& thePolygonsList, TopTools_SequenceOfShape& theFaces)
{
Free();
int Stat = TryOpenShapeFile(theFileName);
return 0;
for (size_t i = 0; i < mySHPObjects.size(); i++)
thePolygonsList.append("polygon_" + QString::number(i + 1));
--
++
TopoDS_Face aF;
if (myHSHP->nShapeType == 5)
{
OSD_Timer timer;
timer.Start();
#endif
-- for (size_t i = 0; i < mySHPObjects.size(); i++)
++ for (size_t i = 0; i < mySHPObjects.size(); i++)
{
- ReadSHPPolygon(mySHPObjects[i], i, aF);
+ ReadSHPPolygon(theDocument, mySHPObjects[i], i, aF);
theFaces.Append(aF);
}
#ifdef OSD_TIMER
}
void HYDROData_ShapeFile::Free()
--{
++{
for (size_t i = 0; i < mySHPObjects.size(); i++ )
free (mySHPObjects[i]);
if (myHSHP != NULL)
{
SHPClose(myHSHP);
-- myHSHP = NULL;
++ myHSHP = NULL;
}
}
--void HYDROData_ShapeFile::ReadSHPPolyXY(Handle(HYDROData_Document) theDocument, SHPObject* anObj, QString theFileName,
- int theInd, NCollection_Sequence<Handle_HYDROData_Entity>& theEntities)
++void HYDROData_ShapeFile::ReadSHPPolyXY(Handle(HYDROData_Document) theDocument, SHPObject* anObj, QString theFileName,
+ int theInd, NCollection_Sequence<Handle(HYDROData_Entity)>& theEntities, bool bReadAsPolyline)
{
-
Handle(HYDROData_PolylineXY) aPolylineXY = Handle(HYDROData_PolylineXY)::DownCast( theDocument->CreateObject( KIND_POLYLINEXY ) );
--
++
int nParts = anObj->nParts;
for ( int i = 0 ; i < nParts ; i++ )
{
else
EndIndex = anObj->nVertices;
- bool IsClosed = false;
-- HYDROData_PolylineXY::SectionType aSectType = HYDROData_PolylineXY::SECTION_POLYLINE;
- if (anObj->padfX[StartIndex] == anObj->padfX[EndIndex - 1] &&
- anObj->padfY[StartIndex] == anObj->padfY[EndIndex - 1] )
++ HYDROData_PolylineXY::SectionType aSectType = HYDROData_PolylineXY::SECTION_POLYLINE;
+ if (!bReadAsPolyline)
{
- IsClosed = true;
- aPolylineXY->AddSection( TCollection_AsciiString( ("poly_section_" + QString::number(i)).data()->toLatin1()), aSectType, true);
+ bool IsClosed = false;
+ if (anObj->padfX[StartIndex] == anObj->padfX[EndIndex - 1] &&
+ anObj->padfY[StartIndex] == anObj->padfY[EndIndex - 1] )
+ {
+ IsClosed = true;
+ aPolylineXY->AddSection( TCollection_AsciiString( ("poly_section_" + QString::number(i)).data()->toLatin1()), aSectType, true);
+ }
+ else
+ aPolylineXY->AddSection( TCollection_AsciiString( ("poly_section_" + QString::number(i)).data()->toLatin1()), aSectType, false);
+
+ if (IsClosed)
+ EndIndex--;
}
else
- aPolylineXY->AddSection( TCollection_AsciiString( ("poly_section_" + QString::number(i)).data()->toLatin1()), aSectType, false);
-
- if (IsClosed)
+ {
+ //polygon; contours always closed
+ aPolylineXY->AddSection( TCollection_AsciiString( ("poly_section_" + QString::number(i)).data()->toLatin1()), aSectType, true);
EndIndex--;
+ }
for ( int k = StartIndex; k < EndIndex ; k++ )
{
- HYDROData_PolylineXY::Point aSectPoint;
- aSectPoint.SetX( anObj->padfX[k] );
- aSectPoint.SetY( anObj->padfY[k] );
+ HYDROData_PolylineXY::Point aSectPoint = gp_XY(anObj->padfX[k], anObj->padfY[k]);
+ theDocument->Transform(aSectPoint, true);
aPolylineXY->AddPoint( i, aSectPoint );
}
}
--
++
aPolylineXY->SetWireColor( HYDROData_PolylineXY::DefaultWireColor() );
aPolylineXY->SetName( theFileName + "_PolyXY_" + QString::number(theInd) );
--
++
aPolylineXY->Update();
theEntities.Append(aPolylineXY);
-void HYDROData_ShapeFile::ReadSHPPoly3D(Handle(HYDROData_Document) theDocument, SHPObject* anObj,
- const Handle(HYDROData_PolylineXY)& aPolylineXY,
+ }
+
+
- HYDROData_PolylineXY::SectionType aSectType = HYDROData_PolylineXY::SECTION_POLYLINE;
++void HYDROData_ShapeFile::ReadSHPPoly3D(Handle(HYDROData_Document) theDocument, SHPObject* anObj,
++ const Handle(HYDROData_PolylineXY)& aPolylineXY,
+ NCollection_Sequence<Handle(HYDROData_Entity)>& theEntities)
+ {
+ Handle(HYDROData_Polyline3D) aPolylineObj = Handle(HYDROData_Polyline3D)::DownCast( theDocument->CreateObject( KIND_POLYLINE ) );
+ Handle(HYDROData_Bathymetry) aBath = Handle(HYDROData_Bathymetry)::DownCast( theDocument->CreateObject( KIND_BATHYMETRY ) );
+
+ HYDROData_Bathymetry::AltitudePoints aAPoints;
+
+ int nParts = anObj->nParts;
+ for ( int i = 0 ; i < nParts ; i++ )
+ {
+ //bool aSectClosure = true;
+ int StartIndex = anObj->panPartStart[i];
+ int EndIndex;
+ if (i != nParts - 1)
+ EndIndex = anObj->panPartStart[i + 1];
+ else
+ EndIndex = anObj->nVertices;
+
- anObj->padfZ[StartIndex] == anObj->padfZ[EndIndex - 1])
++ HYDROData_PolylineXY::SectionType aSectType = HYDROData_PolylineXY::SECTION_POLYLINE;
+ if (anObj->padfX[StartIndex] == anObj->padfX[EndIndex - 1] &&
+ anObj->padfY[StartIndex] == anObj->padfY[EndIndex - 1] &&
- aAPoints.push_back(p);
++ anObj->padfZ[StartIndex] == anObj->padfZ[EndIndex - 1])
+ EndIndex--;
+ for ( int k = StartIndex ; k < EndIndex ; k++ )
+ {
+ gp_XYZ xyz(anObj->padfX[k], anObj->padfY[k], anObj->padfZ[k]);
+ theDocument->Transform(xyz, true);
+ HYDROData_Bathymetry::AltitudePoint p;
+ p.X = xyz.X();
+ p.Y = xyz.Y();
+ p.Z = xyz.Z();
-
++ aAPoints.push_back(p);
+ }
+ }
+
+ QString PolyXYName = aPolylineXY->GetName();
+ QString aPoly3DName = PolyXYName, aBathyName = PolyXYName;
+ aPoly3DName.replace(PolyXYName.lastIndexOf("_PolyXY_"), 8, "_Poly3D_");
+ aBathyName.replace(PolyXYName.lastIndexOf("_Bath_"), 6, "_Poly3D_");
++
+ aBath->SetAltitudePoints(aAPoints);
+ aBath->SetName( aBathyName );
+
+ aPolylineObj->SetPolylineXY (aPolylineXY, false);
+ aPolylineObj->SetAltitudeObject(aBath);
+
+ aPolylineObj->SetBorderColor( aPolylineObj->DefaultBorderColor() );
+ aPolylineObj->SetName( aPoly3DName );
+
+ aPolylineObj->Update();
+ theEntities.Append(aPolylineObj);
}
- void HYDROData_ShapeFile::ReadSHPPoly3D(Handle(HYDROData_Document) theDocument, SHPObject* anObj, QString theFileName,
- int theInd, NCollection_Sequence<Handle_HYDROData_Entity>& theEntities)
+ /*
-void HYDROData_ShapeFile::ReadSHPPoly3D(Handle(HYDROData_Document) theDocument, SHPObject* anObj, QString theFileName,
++void HYDROData_ShapeFile::ReadSHPPoly3D(Handle(HYDROData_Document) theDocument, SHPObject* anObj, QString theFileName,
+ int theInd, bool XYOnly, NCollection_Sequence<Handle(HYDROData_Entity)>& theEntities)
{
Handle(HYDROData_PolylineXY) aPolylineXY = Handle(HYDROData_PolylineXY)::DownCast( theDocument->CreateObject( KIND_POLYLINEXY ) );
EndIndex = anObj->nVertices;
bool IsClosed = false;
-- HYDROData_PolylineXY::SectionType aSectType = HYDROData_PolylineXY::SECTION_POLYLINE;
++ HYDROData_PolylineXY::SectionType aSectType = HYDROData_PolylineXY::SECTION_POLYLINE;
if (anObj->padfX[StartIndex] == anObj->padfX[EndIndex - 1] &&
anObj->padfY[StartIndex] == anObj->padfY[EndIndex - 1] &&
anObj->padfZ[StartIndex] == anObj->padfZ[EndIndex - 1])
}
else
aPolylineXY->AddSection( TCollection_AsciiString( ("poly_section_" + QString::number(i)).data()->toLatin1()), aSectType, false );
--
++
if (IsClosed)
EndIndex--;
for ( int k = StartIndex ; k < EndIndex ; k++ )
if (aStat != 0)
return aStat;
-
+ //SHPHandle aHSHP;
+ myHSHP = SHPOpen( theFileName.toLatin1().data(), "rb" );
+ if (myHSHP == NULL)
+ return -1;
+
+ if (!Parse(myHSHP, HYDROData_ShapeFile::ShapeType_Polyline))
+ return -1;
-int HYDROData_ShapeFile::ImportPolylines(Handle(HYDROData_Document) theDocument,
- const QString& theFileName,
- NCollection_IndexedDataMap<Handle(HYDROData_Entity), SHPObject*>& theEntitiesToSHPObj,
++
+ return 1;
+ //sh_type = aHSHP->nShapeType;
+ }
+
++int HYDROData_ShapeFile::ImportPolylines(Handle(HYDROData_Document) theDocument,
++ const QString& theFileName,
++ NCollection_IndexedDataMap<Handle(HYDROData_Entity), SHPObject*>& theEntitiesToSHPObj,
+ ImportShapeType theShapeTypesToImport)
+ {
+ int aStat = -1;
+ int sh_type = myHSHP->nShapeType;
+ QFileInfo aFileInfo(theFileName);
+ QString aBaseFileName = aFileInfo.baseName();
HYDROData_Iterator anIter( theDocument );
int anInd = 0;
QStringList anExistingNames;
for( ; anIter.More(); anIter.Next() )
anExistingNames.push_back(anIter.Current()->GetName());
- SHPHandle aHSHP;
- aHSHP = SHPOpen( theFileName.toLatin1().data(), "rb" );
-
- QFileInfo aFileInfo(theFileName);
- QString aBaseFileName = aFileInfo.baseName();
-
- if (!Parse(aHSHP, HYDROData_ShapeFile::ShapeType_Polyline, theShapeTypeOfFile))
- return 0;
- if (aHSHP->nShapeType == 3 || aHSHP->nShapeType == 23)
+ NCollection_Sequence<Handle(HYDROData_Entity)> Ents;
- if ((theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_All ||
- theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_Polyline)
++ if ((theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_All ||
++ theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_Polyline)
+ && (sh_type == 3 || sh_type == 23))
{
- anInd = 0;
- for (;anAllowedIndexes.size() < mySHPObjects.size();)
- {
- if (!anExistingNames.contains(aBaseFileName + "_PolyXY_" + QString::number(anInd)))
- {
- anAllowedIndexes.push_back(anInd);
- anInd++;
- }
- else
- anInd++;
- }
-
+ size_t anObjsSize = mySHPObjects.size();
+ GetFreeIndices(anAllowedIndexes, "_PolyXY_", anObjsSize, anExistingNames, aBaseFileName);
-
++
for (size_t i = 0; i < mySHPObjects.size(); i++ )
{
- ReadSHPPolyXY(theDocument, mySHPObjects[i], aBaseFileName, anAllowedIndexes[i], theEntities);
+ ReadSHPPolyXY(theDocument, mySHPObjects[i], aBaseFileName, anAllowedIndexes[i], Ents, false);
+ for (int k=1;k<=Ents.Size();k++)
+ theEntitiesToSHPObj.Add(Ents(k), mySHPObjects[i]);
}
aStat = 1;
}
- else if (aHSHP->nShapeType == 13)
- else if ((theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_All ||
++ else if ((theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_All ||
+ theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_Polyline3D) && sh_type == 13)
{
anInd = 0;
for (;anAllowedIndexes.size() < mySHPObjects.size();)
anInd++;
}
for (size_t i = 0; i < mySHPObjects.size(); i++ )
- ReadSHPPoly3D(theDocument, mySHPObjects[i], aBaseFileName, anAllowedIndexes[i], theEntities);
+ {
- //ReadSHPPoly3D(theDocument, mySHPObjects[i], aBaseFileName, anAllowedIndexes[i], false, theEntities);
- ReadSHPPolyXY(theDocument, mySHPObjects[i], aBaseFileName, anAllowedIndexes[i], Ents, false); //TODO check Z coord on closeness
++ //ReadSHPPoly3D(theDocument, mySHPObjects[i], aBaseFileName, anAllowedIndexes[i], false, theEntities);
++ ReadSHPPolyXY(theDocument, mySHPObjects[i], aBaseFileName, anAllowedIndexes[i], Ents, false); //TODO check Z coord on closeness
+ for (int k=1;k<=Ents.Size();k++)
+ theEntitiesToSHPObj.Add(Ents(k), mySHPObjects[i]);
+ }
aStat = 1;
}
- else
- else if ((theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_All ||
++ else if ((theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_All ||
+ theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_Polygon) && sh_type == 5)
+ {
+ //import polygon's contours as polylines
+ size_t anObjsSize = mySHPObjects.size();
+ GetFreeIndices(anAllowedIndexes, "_PolyXY_", anObjsSize, anExistingNames, aBaseFileName);
-
++
+ for (size_t i = 0; i < mySHPObjects.size(); i++ )
+ {
+ ReadSHPPolyXY(theDocument, mySHPObjects[i], aBaseFileName, anAllowedIndexes[i], Ents, true);
+ for (int k=1;k<=Ents.Size();k++)
+ theEntitiesToSHPObj.Add(Ents(k), mySHPObjects[i]);
+ }
+ aStat = 2;
+ }
- else
++ else
{
aStat = 0;
}
--
- for (size_t i = 0; i < mySHPObjects.size(); i++ )
- free (mySHPObjects[i]);
+
- mySHPObjects.clear();
- SHPClose(aHSHP);
return aStat;
}
- else
+ int HYDROData_ShapeFile::GetShapeType() const
+ {
+ if (myHSHP != NULL)
+ return myHSHP->nShapeType;
-int HYDROData_ShapeFile::ImportPolylines3D(Handle(HYDROData_Document) theDocument,
- NCollection_IndexedDataMap<Handle(HYDROData_Entity), SHPObject*> thePolyXYToObj,
++ else
+ return -1;
+ }
+
- if ((theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_All ||
++int HYDROData_ShapeFile::ImportPolylines3D(Handle(HYDROData_Document) theDocument,
++ NCollection_IndexedDataMap<Handle(HYDROData_Entity), SHPObject*> thePolyXYToObj,
+ NCollection_Sequence<Handle(HYDROData_Entity)>& theEntities,
+ ImportShapeType theShapeTypesToImport)
+ {
+ int aStat = -1;
+ int sh_type = myHSHP->nShapeType;
- ReadSHPPoly3D(theDocument, thePolyXYToObj(i), aPolylineXY, theEntities);
++ if ((theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_All ||
+ theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_Polyline3D) && sh_type == 13)
+ {
+ //for (size_t i = 0; i < mySHPObjects.size(); i++ )
+ for (int i = 1; i <= thePolyXYToObj.Extent(); i++ )
+ {
+ Handle(HYDROData_PolylineXY) aPolylineXY = Handle(HYDROData_PolylineXY)::DownCast( thePolyXYToObj.FindKey(i) );
- else
++ ReadSHPPoly3D(theDocument, thePolyXYToObj(i), aPolylineXY, theEntities);
+ }
+ aStat = 1;
+ }
-
++ else
+ aStat = 0;
++
+ return aStat;
+ }
+
+
QString HYDROData_ShapeFile::GetShapeTypeName(int theType)
{
switch (theType)
if (pFileSHX == NULL)
return -2;
}
--
++
fclose (pFileSHP);
fclose (pFileSHX);
return 0;
{
return false;
}
--
++
fclose (pFileDBF);
thePathToDBFFile = aDBFfile;
return true;
{
int nWidth, nDecimals;
char chField[12];
--
++
for( int i = 0; i < DBFGetRecordCount(myHDBF); i++ )
-- {
++ {
DBFFieldType eType;
DBF_AttrValue anAttr;
eType = DBFGetFieldInfo( myHDBF, theIndexOfField, chField, &nWidth, &nDecimals );
anAttr.myStrVal = QString(chAttr);
break;
}
--
++
case FTInteger:
{
int iAttr = DBFReadIntegerAttribute( myHDBF, i, theIndexOfField );
anAttr.myIntVal = iAttr;
break;
}
--
++
case FTDouble:
{
double dAttr = DBFReadDoubleAttribute( myHDBF, i, theIndexOfField );
hDBF = DBFCreate( theFileName.toStdString().c_str() );
if( hDBF == NULL )
return false;
--
-- if (theType != DBF_FieldType_String && theType != DBF_FieldType_Integer && theType != DBF_FieldType_Double)
++
++ if (theType != DBF_FieldType_String && theType != DBF_FieldType_Integer && theType != DBF_FieldType_Double)
{
DBFClose( hDBF );
return false; //cant handle any other cases
DBFAddField (hDBF, theFieldName.toStdString().c_str(), FTString, nWidth, 0);
break;
}
--
++
case DBF_FieldType_Integer:
{
DBFAddField (hDBF, theFieldName.toStdString().c_str(), FTInteger, nWidth, 0);
break;
}
--
++
case DBF_FieldType_Double:
{
DBFAddField (hDBF, theFieldName.toStdString().c_str(), FTDouble, nWidth, 0);
break;
}
-- if (DBFGetFieldCount( hDBF ) != 1)
++ if (DBFGetFieldCount( hDBF ) != 1)
{
DBFClose( hDBF );
return false;
stat = DBFWriteStringAttribute(hDBF, (int)i, 0, theAttrV[i].myStrVal.toStdString().c_str());
break;
}
--
++
case DBF_FieldType_Integer:
{
stat = DBFWriteIntegerAttribute(hDBF, (int)i, 0, theAttrV[i].myIntVal);
break;
}
--
++
case DBF_FieldType_Double:
{
stat = DBFWriteDoubleAttribute(hDBF, (int)i, 0, theAttrV[i].myDoubleVal);
include(../../CMake/Common.cmake)
+ include(../../CMake/UseQT4EXT.cmake)
+ INCLUDE(UseQtExt)
- IF (SalomeGUI_VERSION VERSION_LESS "8.0.0")
- INCLUDE(UseQt4Ext)
- ELSE()
- INCLUDE(UseQtExt)
- ENDIF()
-
--set(PROJECT_HEADERS
++set(PROJECT_HEADERS
HYDROGUI.h
HYDROGUI_AbstractDisplayer.h
HYDROGUI_AISShape.h
HYDROGUI_LandCoverColoringOp.h
HYDROGUI_SetTransparencyOp.h
HYDROGUI_TransparencyDlg.h
+ HYDROGUI_Overview.h
+ HYDROGUI_PolylineStyleOp.h
+ HYDROGUI_PolylineStyleDlg.h
+ HYDROGUI_ZoneTool.h
+ HYDROGUI_RegenerateRegionColorsOp.h
+ HYDROGUI_ZoneSetColorOp.h
+ HYDROGUI_PolyAttrDlg.h
+ HYDROGUI_ShowAttrPolyOp.h
+ HYDROGUI_SetBoundaryTypePolygonOp.h
+ HYDROGUI_SetBoundaryTypePolygonDlg.h
+ HYDROGUI_MeasurementToolOp.h
+ HYDROGUI_MeasurementToolDlg.h
+ HYDROGUI_SIProgressIndicator.h
+ HYDROGUI_ZIProgressIndicator.h
+ HYDROGUI_ImportPolylineDlg.h
+ HYDROGUI_ImportSinusXDlg.h
)
- IF(NOT SALOME_GUI_BUILD_WITH_QT5)
- QT4_WRAP_CPP(PROJECT_HEADERS_MOC ${PROJECT_HEADERS})
- ELSE()
- QT_WRAP_MOC(PROJECT_HEADERS_MOC ${PROJECT_HEADERS})
- ENDIF()
+ QT_WRAP_MOC(PROJECT_HEADERS_MOC ${PROJECT_HEADERS})
--set(PROJECT_SOURCES
++set(PROJECT_SOURCES
HYDROGUI_AbstractDisplayer.cxx
HYDROGUI_AISShape.cxx
HYDROGUI_AISTrihedron.cxx
add_library(HYDROGUI SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS} ${PROJECT_HEADERS_MOC})
target_link_libraries(HYDROGUI HYDROData shapelib
${CAS_TKV3d} ${CAS_TKTopAlgo} ${CAS_TKBrep} ${CAS_TKBO}
-- ${GUI_LightApp} ${GUI_CAM} ${GUI_suit} ${GUI_qtx} ${GUI_ObjBrowser} ${GUI_GraphicsView} ${GUI_std}
++ ${GUI_LightApp} ${GUI_CAM} ${GUI_suit} ${GUI_qtx} ${GUI_ObjBrowser} ${GUI_GraphicsView} ${GUI_std}
${GUI_Event} ${GUI_OCCViewer} ${GEOM_GEOM} ${GEOM_GEOMBase} ${GEOM_CurveCreator}
${VTK_LIBRARIES} ${SVTK} ${SalomeObject} ${SalomePrs}
)
#include <SUIT_ResourceMgr.h>
#include <SUIT_SelectionMgr.h>
#include <SUIT_DataObjectIterator.h>
--
++
#define VISIBILITY_COLUMN_WIDTH 25
}
DataObjectList objList;
-- for ( SUIT_DataOwnerPtrList::const_iterator it = theList.begin();
++ for ( SUIT_DataOwnerPtrList::const_iterator it = theList.begin();
it != theList.end(); ++it ) {
const LightApp_DataOwner* owner = dynamic_cast<const LightApp_DataOwner*>( (*it).operator->() );
// Mantis issue 0020136: Drag&Drop in OB
SUIT_ProxyModel* proxyModel = dynamic_cast<SUIT_ProxyModel*>(treeModel);
if ( proxyModel ) {
-- connect( proxyModel,
++ connect( proxyModel,
SIGNAL( dropped( const QList<SUIT_DataObject*>&, SUIT_DataObject*, int, Qt::DropAction ) ),
SIGNAL( dropped( const QList<SUIT_DataObject*>&, SUIT_DataObject*, int, Qt::DropAction ) ) );
SUIT_TreeModel* aMiniModel = dynamic_cast<SUIT_TreeModel*>( proxyModel->sourceModel() );
if ( aMiniModel )
{
-- connect( aMiniModel, SIGNAL( dataChanged( const QModelIndex &, const QModelIndex & ) ),
++ connect( aMiniModel, SIGNAL( dataChanged( const QModelIndex &, const QModelIndex & ) ),
SIGNAL( dataChanged() ) );
}
if ( aPModel )
{
SUIT_TreeModel* aModel = dynamic_cast<SUIT_TreeModel*>(aPModel->sourceModel());
-- //connect( proxyModel, SIGNAL( dataChanged( const QModelIndex &, const QModelIndex & ) ),
++ //connect( proxyModel, SIGNAL( dataChanged( const QModelIndex &, const QModelIndex & ) ),
// aPModel, SIGNAL( dataChanged( const QModelIndex &, const QModelIndex & ) ) );
-- //connect( proxyModel, SIGNAL( dataChanged( const QModelIndex &, const QModelIndex & ) ),
++ //connect( proxyModel, SIGNAL( dataChanged( const QModelIndex &, const QModelIndex & ) ),
// aModel, SIGNAL( dataChanged( const QModelIndex &, const QModelIndex & ) ) );
connect( proxyModel, SIGNAL( modelUpdated() ), aModel, SIGNAL( modelUpdated() ) );
}
{
res = DocError_UnknownProblem;
}
--
++
if ( res != DocError_OK )
{
module()->application()->putInfo( tr( "LOAD_ERROR" ) );
bool HYDROGUI_DataModel::save( QStringList& theFileList )
{
+ DEBTRACE("save");
if( !module()->application()->activeStudy() )
return false;
--
++
LightApp_DataModel::save( theFileList );
QString aTmpDir;
// save module data to temporary files
LightApp_Study* aStudy = dynamic_cast<LightApp_Study*>( module()->application()->activeStudy() );
aTmpDir = aStudy->GetTmpDir( myStudyURL.toLatin1().constData(), isMultiFile ).c_str();
--
++
// save OCAF data to a temporary file
QString aDataFileName = SUIT_Tools::file( myStudyURL, false ) + "_HYDRO.cbf";
QString aDataFullPath = aTmpDir + aDataFileName;
// anObjectBrowser->openLevels();
//}
- HYDROGUI_DataModelSync aSync( aNewRootObj );
SUIT_DataObject* aRoot = root();
- //new root - remove children
+
+ if (aRoot)
+ {
+ std::map<std::string, SUIT_DataObject*> entry2ObjNewRoot;
+ SUIT_DataObjectIterator::DetourType dt = SUIT_DataObjectIterator::DepthLeft;
+ for ( SUIT_DataObjectIterator it( aNewRootObj, dt ); it.current(); ++it )
+ {
+ LightApp_DataObject* aCurObjN = dynamic_cast<LightApp_DataObject*>(it.current());
+ if (aCurObjN)
+ entry2ObjNewRoot[aCurObjN->entry().toStdString()] = it.current();
+ }
+
+ for ( SUIT_DataObjectIterator it( aRoot, dt ); it.current(); ++it )
+ {
+ LightApp_DataObject* aCurObjO = dynamic_cast<LightApp_DataObject*>(it.current());
+ if (aCurObjO && aCurObjO->childCount() > 0)
+ {
+ std::string entry = aCurObjO->entry().toStdString();
+ SUIT_DataObject* newNode = entry2ObjNewRoot[entry];
+ if (newNode && aCurObjO->childCount() > 0)
+ {
+ DataObjectList newchildren;
+ newNode->children(newchildren);
- aCurObjO->children(oldchildren);
++ //new root - remove children
+ std::map<std::string, SUIT_DataObject*> newNode2Entries;
+ for ( DataObjectList::const_iterator it = newchildren.begin(); it != newchildren.end(); ++it )
+ {
+ SUIT_DataObject* cc = *it;
+ LightApp_DataObject* obj = dynamic_cast<LightApp_DataObject*>(cc);
+ newNode2Entries[obj->entry().toStdString()] = cc;
+ newNode->removeChild(cc);
+ }
+ //
+ std::set<SUIT_DataObject*> objtemp;
+
+ DataObjectList oldchildren;
- SUIT_DataObject* obj = newNode2Entries[entr];
++ aCurObjO->children(oldchildren);
+ for ( DataObjectList::const_iterator it = oldchildren.begin(); it != oldchildren.end(); ++it )
+ {
+ SUIT_DataObject* old_ch = *it;
+ std::string entr = dynamic_cast<LightApp_DataObject*>(old_ch)->entry().toStdString();
+ if (newNode2Entries.count(entr) > 0)
+ {
++ SUIT_DataObject* obj = newNode2Entries[entr];
+ newNode->appendChild(obj);
+ objtemp.insert(obj);
+ }
+ }
+ //
+ for ( DataObjectList::const_iterator it = newchildren.begin(); it != newchildren.end(); ++it )
+ {
+ SUIT_DataObject* ch = *it;
+ if (objtemp.count(ch) == 0)
+ newNode->appendChild(ch);
+ }
+ { //IF DEBUG
+ //add. check
+ DataObjectList newchildren2;
+ newNode->children(newchildren2);
+ std::set<std::string> entries2, entries1;
+ for ( DataObjectList::const_iterator it = newchildren2.begin(); it != newchildren2.end(); ++it )
+ entries2.insert((dynamic_cast<LightApp_DataObject*>(*it))->entry().toStdString());
+ for ( DataObjectList::const_iterator it = newchildren.begin(); it != newchildren.end(); ++it )
+ entries1.insert((dynamic_cast<LightApp_DataObject*>(*it))->entry().toStdString());
+ assert(entries1 == entries2);
+ }
+ }
+ }
+ }
+ }
+
+ HYDROGUI_DataModelSync aSync( aNewRootObj );
bool isNewDoc = aRoot==0;
if( isNewDoc )
aRoot = createRootModuleObject( aStudyRoot );
bool HYDROGUI_DataModel::undo()
{
-- try
++ try
{
getDocument()->Undo();
}
bool HYDROGUI_DataModel::redo()
{
-- try
++ try
{
getDocument()->Redo();
}
if( !anObject.IsNull() ) {
ObjectKind aKind = anObject->GetKind();
bool isUnrecognized = aKind <= KIND_UNKNOWN || aKind > KIND_LAST;
-- bool isChildObject = aKind == KIND_DUMMY_3D ||
++ bool isChildObject = aKind == KIND_DUMMY_3D ||
aKind == KIND_ZONE ||
-- aKind == KIND_SHAPES_GROUP ||
++ aKind == KIND_SHAPES_GROUP ||
aKind == KIND_SPLIT_GROUP;
if ( isUnrecognized || isChildObject ) {
isCanCopy = false;
}
}
}
--
++
return isCanCopy;
}
const bool theIsBuildTree,
const bool theIsInOperation )
{
-- return buildObject( theParent, new HYDROGUI_Region( theParent, theModelObject, theParentEntry, theIsInOperation ),
++ return buildObject( theParent, new HYDROGUI_Region( theParent, theModelObject, theParentEntry, theIsInOperation ),
theParentEntry, theIsBuildTree, theIsInOperation );
}
{
// Create default Strickler table object
Handle(HYDROData_StricklerTable) aStricklerTableObj =
-- Handle(HYDROData_StricklerTable)::DownCast( theDocument->CreateObject(KIND_STRICKLER_TABLE) );
++ Handle(HYDROData_StricklerTable)::DownCast( theDocument->CreateObject(KIND_STRICKLER_TABLE) );
if ( !aStricklerTableObj.IsNull() )
{
SUIT_ResourceMgr* resMgr = module()->application()->resourceMgr();
if ( !aGuiObj )
return;
-- LightApp_DataObject* aPartSect =
++ LightApp_DataObject* aPartSect =
createObject( aGuiObj, thePartName, aGuiObj->entry() );
HYDROData_SequenceOfObjects::Iterator anIter( theObjects );
Handle(HYDROData_ImmersibleZone) aZoneObj =
Handle(HYDROData_ImmersibleZone)::DownCast( aDataObj );
-- LightApp_DataObject* aPolylineSect =
++ LightApp_DataObject* aPolylineSect =
createObject( aGuiObj, tr( "ZONE_POLYLINE" ), aGuiObj->entry() );
Handle(HYDROData_PolylineXY) aPolyline = aZoneObj->GetPolyline();
if ( !aPolyline.IsNull() && !aPolyline->IsRemoved() )
createObject( aPolylineSect, aPolyline, aGuiObj->entry(), false );
-- LightApp_DataObject* aBathSect =
++ LightApp_DataObject* aBathSect =
createObject( aGuiObj, tr( "ZONE_BATHYMETRY" ), aGuiObj->entry() );
Handle(HYDROData_IAltitudeObject) anAltitudeObj = aZoneObj->GetAltitudeObject();
Handle(HYDROData_Polyline3D) aPolyline3D =
Handle(HYDROData_Polyline3D)::DownCast( aDataObj );
-- LightApp_DataObject* aPolylineSect =
++ LightApp_DataObject* aPolylineSect =
createObject( aGuiObj, tr( "POLYLINE3D_POLYLINE" ), aGuiObj->entry() );
Handle(HYDROData_PolylineXY) aPolylineXY = aPolyline3D->GetPolylineXY();
if ( !aPolylineXY.IsNull() && !aPolylineXY->IsRemoved() )
createObject( aPolylineSect, aPolylineXY, aGuiObj->entry(), false );
-- LightApp_DataObject* aProfileSect =
++ LightApp_DataObject* aProfileSect =
createObject( aGuiObj, tr( "POLYLINE3D_PROFILE" ), aGuiObj->entry() );
Handle(HYDROData_ProfileUZ) aProfileUZ = aPolyline3D->GetProfileUZ();
if ( !aProfileUZ.IsNull() && !aProfileUZ->IsRemoved() )
{
-- Handle(HYDROData_Profile) aProfile =
++ Handle(HYDROData_Profile) aProfile =
Handle(HYDROData_Profile)::DownCast( aProfileUZ->GetFatherObject() );
if ( !aProfile.IsNull() && !aProfile->IsRemoved() )
createObject( aProfileSect, aProfile, aGuiObj->entry(), false );
}
-- LightApp_DataObject* aBathSect =
++ LightApp_DataObject* aBathSect =
createObject( aGuiObj, tr( "POLYLINE3D_BATHYMETRY" ), aGuiObj->entry() );
Handle(HYDROData_IAltitudeObject) anAltitudeObj = aPolyline3D->GetAltitudeObject();
Handle(HYDROData_CalculationCase) aCaseObj =
Handle(HYDROData_CalculationCase)::DownCast( aDataObj );
-- LightApp_DataObject* aPolylineSect =
++ LightApp_DataObject* aPolylineSect =
createObject( aGuiObj, tr( "CASE_BOUNDARY" ), aGuiObj->entry() );
Handle(HYDROData_PolylineXY) aPolyline = aCaseObj->GetBoundaryPolyline();
if ( !aPolyline.IsNull() && !aPolyline->IsRemoved() )
createObject( aPolylineSect, aPolyline, aGuiObj->entry(), false );
-- LightApp_DataObject* aCaseAOSect =
++ LightApp_DataObject* aCaseAOSect =
createObject( aGuiObj, tr( partitionName( KIND_ARTIFICIAL_OBJECT ).toLatin1() ),
aGuiObj->entry() );
-- LightApp_DataObject* aCaseNOSect =
++ LightApp_DataObject* aCaseNOSect =
createObject( aGuiObj, tr( partitionName( KIND_NATURAL_OBJECT ).toLatin1() ),
aGuiObj->entry() );
aNObject = Handle(HYDROData_NaturalObject)::DownCast( anEntity );
if ( !aNObject.IsNull() )
createObject( aCaseNOSect, aNObject, aGuiObj->entry(), false );
- }
+ }
}
- LightApp_DataObject* aLandCoverMapSect =
- LightApp_DataObject* aBoundaryPolygonSect =
++ LightApp_DataObject* aBoundaryPolygonSect =
+ createObject( aGuiObj, tr( "CASE_BOUNDARY_POLYGONS" ), aGuiObj->entry() );
+ HYDROData_SequenceOfObjects aBCPolygons = aCaseObj->GetBoundaryPolygons();
+ for (int i = 1; i <= aBCPolygons.Size(); i++ )
+ createObject( aBoundaryPolygonSect, aBCPolygons(i), aGuiObj->entry(), false );
+
- LightApp_DataObject* aLandCoverMapSect =
++ LightApp_DataObject* aLandCoverMapSect =
createObject( aGuiObj, tr( "CASE_LAND_COVER_MAP" ), aGuiObj->entry() );
Handle(HYDROData_LandCoverMap) aLandCoverMap = aCaseObj->GetLandCoverMap();
if ( !aLandCoverMap.IsNull() && !aLandCoverMap->IsRemoved() )
createObject( aLandCoverMapSect, aLandCoverMap, aGuiObj->entry(), false );
-- LightApp_DataObject* aCaseRegionsSect =
++ LightApp_DataObject* aCaseRegionsSect =
createObject( aGuiObj, tr( "CASE_REGIONS" ), aGuiObj->entry() );
HYDROData_SequenceOfObjects aCaseRegions = aCaseObj->GetRegions();
if( !aCaseRegion.IsNull() && !aCaseRegion->IsRemoved() )
createRegion( aCaseRegionsSect, aCaseRegion, "", true, theIsInOperation );
}
--
++
#ifdef DEB_GROUPS
HYDROData_SequenceOfObjects aCalcGroups = aCaseObj->GetGeometryGroups();
buildObjectPartition( aGuiObj, aCalcGroups, tr( "OBJECT_GROUPS" ), false );
Handle(HYDROData_Channel) aChannelObj =
Handle(HYDROData_Channel)::DownCast( aDataObj );
-- LightApp_DataObject* aGuideLineSect =
++ LightApp_DataObject* aGuideLineSect =
createObject( aGuiObj, tr( "CHANNEL_GUIDE_LINE" ), aGuiObj->entry() );
Handle(HYDROData_Polyline3D) aGuideLine = aChannelObj->GetGuideLine();
if ( !aGuideLine.IsNull() && !aGuideLine->IsRemoved() ) {
createObject( aGuideLineSect, aGuideLine, aGuiObj->entry(), false );
}
-- LightApp_DataObject* aProfileSect =
++ LightApp_DataObject* aProfileSect =
createObject( aGuiObj, tr( "CHANNEL_PROFILE" ), aGuiObj->entry() );
Handle(HYDROData_Profile) aProfile = aChannelObj->GetProfile();
if ( !aProfile.IsNull() && !aProfile->IsRemoved() ) {
Handle(HYDROData_Stream) aStreamObj =
Handle(HYDROData_Stream)::DownCast( aDataObj );
-- LightApp_DataObject* aHydraulicAxisSect =
++ LightApp_DataObject* aHydraulicAxisSect =
createObject( aGuiObj, tr( "STREAM_HYDRAULIC_AXIS" ), aGuiObj->entry() );
Handle(HYDROData_PolylineXY) aHydraulicAxis = aStreamObj->GetHydraulicAxis();
if ( !aHydraulicAxis.IsNull() && !aHydraulicAxis->IsRemoved() ) {
Handle(HYDROData_LandCoverMap) aLandCoverMapObj =
Handle(HYDROData_LandCoverMap)::DownCast( aDataObj );
-- /*TODO: reference objects of the land cover map
++ /*TODO: reference objects of the land cover map
HYDROData_SequenceOfObjects aPolylines = aLandCoverMapObj->GetPolylines();
buildObjectPartition( aGuiObj, aPolylines, tr( "LAND_COVER_POLYLINES" ), true );*/
}
-
+ else if ( anObjectKind == KIND_BC_POLYGON )
+ {
+ Handle(HYDROData_BCPolygon) aBCObj =
+ Handle(HYDROData_BCPolygon)::DownCast( aDataObj );
+
- LightApp_DataObject* aPolylineSect =
++ LightApp_DataObject* aPolylineSect =
+ createObject( aGuiObj, tr( "BC_POLYGON_POLYLINE" ), aGuiObj->entry() );
+
+ Handle(HYDROData_PolylineXY) aPolyline = aBCObj->GetPolyline();
+ if ( !aPolyline.IsNull() && !aPolyline->IsRemoved() )
+ createObject( aPolylineSect, aPolyline, aGuiObj->entry(), false );
+ }
HYDROGUI_Module* aModule = dynamic_cast<HYDROGUI_Module*>( module() );
if( aModule )
aModule->enableLCMActions();
--
++
}
void HYDROGUI_DataModel::buildCaseTree( SUIT_DataObject* theParent, Handle(HYDROData_CalculationCase) theCase )
aParentEntry = aParent->entry();
}
buildObjectTree( aParent, aGuiObj, aParentEntry, aGuiObj->isInOperation() );
-- }
++ }
else
{
// workaround for the bug in SalomeApp_Study::findObjectByEntry - it can't find LightApp_DataObjects
return NULL; // not found
}
--bool HYDROGUI_DataModel::createNewRegion( Handle(HYDROData_CalculationCase) theCase,
++bool HYDROGUI_DataModel::createNewRegion( Handle(HYDROData_CalculationCase) theCase,
const QList<HYDROGUI_Zone*>& theZonesList )
{
bool isOk = !theCase.IsNull();
if ( theName.isEmpty() )
return false;
-- try
++ try
{
getDocument()->StartOperation();
theEntity->SetName( theName );
#include <SUIT_Study.h>
#include <QPixmap>
+ #include <QPainter>
--HYDROGUI_DataObject::HYDROGUI_DataObject( SUIT_DataObject* theParent,
++HYDROGUI_DataObject::HYDROGUI_DataObject( SUIT_DataObject* theParent,
Handle(HYDROData_Entity) theData,
const QString& theParentEntry,
const bool theIsInOperation )
{
QString anIcon;
Handle(HYDROData_Entity) aDataObject = modelObject();
-
+ Handle(HYDROData_Object) anObject;
+ Handle(HYDROData_ArtificialObject) anAObject = Handle( HYDROData_ArtificialObject )::DownCast(aDataObject);
+ Handle(HYDROData_NaturalObject) aNObject = Handle( HYDROData_NaturalObject )::DownCast(aDataObject);
++
+ if (!anAObject.IsNull())
+ anObject = anAObject;
+ if (!aNObject.IsNull())
+ anObject = aNObject;
+
if( aDataObject.IsNull() )
{
anIcon = QObject::tr( "HYDRO_TYPE0_ICO" ); // KIND_UNKNOWN
QString aNeedUpdate( aDataObject->IsMustBeUpdated( HYDROData_Entity::Geom_All ) ? "M_" : "" );
int anObjectKind = (int)aDataObject->GetKind();
+ bool IsUnsImmZone = false;
if ( anObjectKind == KIND_DUMMY_3D )
{
-- Handle(HYDROData_DummyObject3D) anObject3D =
++ Handle(HYDROData_DummyObject3D) anObject3D =
Handle(HYDROData_DummyObject3D)::DownCast( aDataObject );
--
++
Handle(HYDROData_Object) aFatherObj = anObject3D->GetObject();
if ( !aFatherObj.IsNull() )
anObjectKind = aFatherObj->GetKind();
+ anIcon = QObject::tr( QString("HYDRO_%1TYPE%2_ICO").arg( aNeedUpdate ).arg( anObjectKind ).toLatin1() );
}
-
- anIcon = QObject::tr( QString("HYDRO_%1TYPE%2_ICO").arg( aNeedUpdate ).arg( anObjectKind ).toLatin1() );
+ else if ( !anObject.IsNull() )
+ {
+ bool IsSubm = anObject->IsSubmersible();
+ QString anIcon1 = QObject::tr( QString("HYDRO_%1TYPE%2_ICO").arg( aNeedUpdate ).arg( anObjectKind ).toLatin1() );
+ QString anIcon2;
- if (IsSubm)
++ if (IsSubm)
+ anIcon2 = QObject::tr( QString("HYDRO_SUBMERSIBLE16_ICO").toLatin1());
+ else
+ anIcon2 = QObject::tr( QString("HYDRO_UNSUBMERSIBLE16_ICO").toLatin1());
+
+ QPixmap qpm1 = aResMgr->loadPixmap( "HYDRO", anIcon1 );
+ QPixmap qpm2 = aResMgr->loadPixmap( "HYDRO", anIcon2 );
+ QPixmap qpmD(32,16);
+ qpmD.fill(QColor(0,0,0));
+ QPainter painter;
+ painter.begin(&qpmD);
+ painter.drawPixmap(0, 0, qpm1);
+ painter.drawPixmap(16, 0, qpm2);
+ painter.end();
+ return qpmD;
+ }
+ else if (anObjectKind == KIND_BC_POLYGON)
+ {
+ Handle(HYDROData_BCPolygon) aBCObj = Handle(HYDROData_BCPolygon)::DownCast( aDataObject );
+ int aBT = aBCObj->GetBoundaryType();
+ if (aBT == 1)
+ anIcon = QObject::tr( QString("HYDRO_BC_POLYGON_TYPE1_ICO").toLatin1());
+ else if (aBT == 2)
+ anIcon = QObject::tr( QString("HYDRO_BC_POLYGON_TYPE2_ICO").toLatin1());
+ else if (aBT == 3)
+ anIcon = QObject::tr( QString("HYDRO_BC_POLYGON_TYPE3_ICO").toLatin1());
+ else
+ anIcon = QObject::tr( QString("HYDRO_BC_POLYGON_TYPE_UNDEF_ICO").toLatin1());
+ }
+ else
+ anIcon = QObject::tr( QString("HYDRO_%1TYPE%2_ICO").arg( aNeedUpdate ).arg( anObjectKind ).toLatin1() );
}
return aResMgr->loadPixmap( "HYDRO", anIcon );
const QString& theName,
const QString& theParentEntry,
const bool theIsInOperation )
--: HYDROGUI_NamedObject( theParent, theName, theParentEntry, theIsInOperation ),
++: HYDROGUI_NamedObject( theParent, theName, theParentEntry, theIsInOperation ),
CAM_DataObject( theParent )
{
}
aFileNameLayout->addWidget( aFileNameLabel );
aFileNameLayout->addWidget( myFileName );
aFileNameLayout->addWidget( aBrowseBtn );
--
++
myObjectNameGroup = new QGroupBox( tr( "LANDCOVERMAP_NAME" ) );
QLabel* aLandcoverNameLabel = new QLabel( tr( "NAME" ), myObjectNameGroup );
// Conections
connect( myPolygonsListWidget, SIGNAL( itemSelectionChanged() ), this, SLOT( onItemSelectionChanged() ) );
-- connect( aBrowseBtn, SIGNAL( clicked() ), this, SLOT( onBrowse() ) );
++ connect( aBrowseBtn, SIGNAL( clicked() ), this, SLOT( onBrowse() ) );
connect( myAttrCheckBox, SIGNAL(clicked(bool)), this, SLOT(onAttrCBChecked(bool)));
return aPage;
myAvAttrLabel = new QLabel();
myAvAttrLabel->setText(tr("AV_ATTRS"));
--
++
myDBFAttrListWidget = new QListWidget( );
myDBFAttrListWidget->setSelectionMode( QListWidget::SingleSelection );
myDBFAttrListWidget->setEditTriggers( QListWidget::NoEditTriggers );
QFrame* aFrame = new QFrame( aPage );
myCorrLabel = new QLabel();
myCorrLabel->setText(tr ("CORR"));
--
++
myCorrTableWidget = new QTableWidget();
// Layout
}
void HYDROGUI_ImportLandCoverMapDlg::onItemSelectionChanged()
--{
++{
int aCurIndex = getCurrentWizardIndex();
if (aCurIndex == 0 && getViewerState())
emit selectionChanged( getSelectedPolygonNames() );
}
--void HYDROGUI_ImportLandCoverMapDlg::FillCorrespondenceTable(const QStringList& theFirstColumn,
++void HYDROGUI_ImportLandCoverMapDlg::FillCorrespondenceTable(const QStringList& theFirstColumn,
const QStringList& theSecondColumn,
const QVector<int> theDefCBIndices,
const QVector<QColor> theColors)
{
int aFCSize = theFirstColumn.size(); // == theDefCBIndices.size() !
-- int aSCSize = theSecondColumn.size();
++ int aSCSize = theSecondColumn.size();
myStrColors = theColors;
case Qt::DecorationRole:
{
-- if( myIsDecorationEnabled &&
++ if( myIsDecorationEnabled &&
aColumn==0 && aRow >=0 && aRow < myObjects.count() ) {
bool isVisible = isObjectVisible( aRow );
if( isVisible )
@param theIsToSort defines if the list of ids should be sorted in ascending order
@return the list of ids
*/
--QList<int> HYDROGUI_ListModel::getIds( const QModelIndexList& theIndexes,
++QList<int> HYDROGUI_ListModel::getIds( const QModelIndexList& theIndexes,
bool theIsToSort ) const
{
QList<int> anIds;
aRes = true;
}
}
--
++
return aRes;
}
@param theDropItem the drop item id ( used for drag and drop obly )
@return true in case of success
*/
--bool HYDROGUI_ListModel::move( const QList<int>& theItems, const OpType theType,
++bool HYDROGUI_ListModel::move( const QList<int>& theItems, const OpType theType,
bool theIsVisibleOnly, const int theDropItem )
{
bool aRes = true;
default:
aRes = false;
}
--
++
return aRes;
}
@param theDropItem the drop item id
@return true if drag and drop allowed
*/
--bool HYDROGUI_ListModel::isDragAndDropAllowed( const QList<int>& theItems,
++bool HYDROGUI_ListModel::isDragAndDropAllowed( const QList<int>& theItems,
const int theDropItem ) const
{
bool isAllowed = false;
-- if ( theDropItem >= 0 &&
++ if ( theDropItem >= 0 &&
// TODO: to disable drop between items use: theDropItem < myObjects.count()
theDropItem <= myObjects.count() &&
!theItems.empty() && theItems.count() < myObjects.count() &&
virtual QStringList mimeTypes() const;
virtual bool dropMimeData( const QMimeData* theData, Qt::DropAction theAction,
int theRow, int theColumn, const QModelIndex& theParent );
+ virtual Qt::DropActions supportedDragActions() const;
virtual Qt::DropActions supportedDropActions() const;
+ virtual Qt::DropActions supportedDragActions() const;
QList<int> getIds( const QModelIndexList& theIndexes, bool theIsToSort = true ) const;
/**
*/
--QWidget* HYDROGUI_PriorityWidget::Delegate::createEditor(
++QWidget* HYDROGUI_PriorityWidget::Delegate::createEditor(
QWidget* theParent, const QStyleOptionViewItem& theOption,
const QModelIndex& theIndex ) const
{
QStringList anObjNames = theIndex.data( Qt::UserRole ).toStringList();
aComboBox->addItems( anObjNames );
}
--
++
connect( aComboBox, SIGNAL( activated( int ) ), this, SLOT( finishEditing() ) );
return aComboBox;
/**
*/
--void HYDROGUI_PriorityWidget::Delegate::setEditorData(
++void HYDROGUI_PriorityWidget::Delegate::setEditorData(
QWidget* theEditor, const QModelIndex& theIndex ) const
{
QComboBox* aComboBox = dynamic_cast<QComboBox*>( theEditor );
/**
*/
--void HYDROGUI_PriorityWidget::Delegate::setModelData(
++void HYDROGUI_PriorityWidget::Delegate::setModelData(
QWidget* theEditor, QAbstractItemModel* theModel, const QModelIndex& theIndex) const
{
QComboBox* aComboBox = dynamic_cast<QComboBox*>( theEditor );
myRemove->setText( tr( "REMOVE" ) );
myClear = new QToolButton;
myClear->setText( tr( "CLEAR_ALL" ) );
--
++
// Table view
myTable = new QTableView( this );
myTable->setItemDelegate( new Delegate( this ) );
myTable->setEditTriggers( QAbstractItemView::DoubleClicked |
QAbstractItemView::SelectedClicked |
QAbstractItemView::EditKeyPressed );
--
++
// Set the custom model
HYDROGUI_PriorityTableModel* aModel = new HYDROGUI_PriorityTableModel();
myTable->setModel( aModel );
// Set resize mode
myTable->horizontalHeader()->setStretchLastSection( false);
- HYDROGUI_Tool::setResizeMode( myTable->horizontalHeader(), 0, QHeaderView::Stretch );
- HYDROGUI_Tool::setResizeMode( myTable->horizontalHeader(), 1, QHeaderView::ResizeToContents );
- HYDROGUI_Tool::setResizeMode( myTable->horizontalHeader(), 2, QHeaderView::Stretch );
- HYDROGUI_Tool::setResizeMode( myTable->horizontalHeader(), 3, QHeaderView::ResizeToContents );
+ myTable->horizontalHeader()->setSectionResizeMode( 0, QHeaderView::Stretch );
+ myTable->horizontalHeader()->setSectionResizeMode( 1, QHeaderView::ResizeToContents );
+ myTable->horizontalHeader()->setSectionResizeMode( 2, QHeaderView::Stretch );
+ myTable->horizontalHeader()->setSectionResizeMode( 3, QHeaderView::ResizeToContents );
+
+ myTable->verticalHeader()->setSectionResizeMode( QHeaderView::ResizeToContents );
-
+
- HYDROGUI_Tool::setResizeMode( myTable->verticalHeader(), QHeaderView::ResizeToContents );
-
// Layout
// buttons
QHBoxLayout* aButtonsLayout = new QHBoxLayout();
// main
aMainLayout->addLayout( aButtonsLayout );
aMainLayout->addWidget( myTable );
--
++
// Update controls
updateControls();
connect( myRemove, SIGNAL( clicked() ), this, SLOT( onRemoveRule() ) );
connect( myClear, SIGNAL( clicked() ), this, SLOT( onClearRules() ) );
-- connect ( myTable->selectionModel(), SIGNAL( selectionChanged( QItemSelection, QItemSelection ) ),
++ connect ( myTable->selectionModel(), SIGNAL( selectionChanged( QItemSelection, QItemSelection ) ),
this, SLOT( onSelectionChanged() ) );
connect( aModel, SIGNAL( showError( const QString& ) ), this, SLOT( onShowError( const QString& ) ) );
*/
void HYDROGUI_PriorityWidget::onAddRule()
{
-- HYDROGUI_PriorityTableModel* aModel =
++ HYDROGUI_PriorityTableModel* aModel =
dynamic_cast<HYDROGUI_PriorityTableModel*>( myTable->model() );
if ( aModel ) {
if (aModel->createNewRule()) {
*/
void HYDROGUI_PriorityWidget::onRemoveRule()
{
-- HYDROGUI_PriorityTableModel* aModel =
++ HYDROGUI_PriorityTableModel* aModel =
dynamic_cast<HYDROGUI_PriorityTableModel*>( myTable->model() );
if (aModel) {
if ( !aRows.contains( aRowIndex ) )
aRows << aRowIndex;
}
--
++
if ( aModel->removeRows( aRows ) ) {
updateControls();
emit ruleChanged();
*/
void HYDROGUI_PriorityWidget::onClearRules()
{
-- HYDROGUI_PriorityTableModel* aModel =
++ HYDROGUI_PriorityTableModel* aModel =
dynamic_cast<HYDROGUI_PriorityTableModel*>( myTable->model() );
if ( aModel && aModel->removeAll() ) {
updateControls();
*/
void HYDROGUI_PriorityWidget::setObjects( const QList<Handle(HYDROData_Entity)>& theObjects )
{
-- HYDROGUI_PriorityTableModel* aModel =
++ HYDROGUI_PriorityTableModel* aModel =
dynamic_cast<HYDROGUI_PriorityTableModel*>( myTable->model() );
if( aModel ) {
aModel->setObjects( theObjects );
{
HYDROData_ListOfRules aRules;
-- HYDROGUI_PriorityTableModel* aModel =
++ HYDROGUI_PriorityTableModel* aModel =
dynamic_cast<HYDROGUI_PriorityTableModel*>( myTable->model() );
if( aModel ) {
aRules = aModel->getRules();
*/
void HYDROGUI_PriorityWidget::setRules( const HYDROData_ListOfRules& theRules )
{
-- HYDROGUI_PriorityTableModel* aModel =
++ HYDROGUI_PriorityTableModel* aModel =
dynamic_cast<HYDROGUI_PriorityTableModel*>( myTable->model() );
if( aModel ) {
aModel->setRules( theRules );
*/
void HYDROGUI_PriorityWidget::updateControls()
{
-- HYDROGUI_PriorityTableModel* aModel =
++ HYDROGUI_PriorityTableModel* aModel =
dynamic_cast<HYDROGUI_PriorityTableModel*>( myTable->model() );
if( aModel ) {
myAdd->setEnabled( aModel->canCreateNewRule() );
*/
void HYDROGUI_PriorityWidget::undoLastChange()
{
-- HYDROGUI_PriorityTableModel* aModel =
++ HYDROGUI_PriorityTableModel* aModel =
dynamic_cast<HYDROGUI_PriorityTableModel*>( myTable->model() );
if ( aModel )
aModel->undoLastChange();
connect( myAddBtn, SIGNAL( clicked() ), this, SLOT( onAddCoefficient() ) );
connect( myRemoveBtn, SIGNAL( clicked() ), this, SLOT( onRemoveCoefficient() ) );
connect( myClearBtn, SIGNAL( clicked() ), this, SLOT( onClearCoefficients() ) );
-- connect( myTable->selectionModel(), SIGNAL( selectionChanged( QItemSelection, QItemSelection ) ),
-- this, SLOT( onSelectionChanged() ) );
++ connect( myTable->selectionModel(), SIGNAL( selectionChanged( QItemSelection, QItemSelection ) ),
++ this, SLOT( onSelectionChanged() ) );
setMinimumWidth( 450 );
myTable->insertRow( aRow );
// "Type" column
-- QTableWidgetItem* aTypeItem = new QTableWidgetItem( aType );
++ QTableWidgetItem* aTypeItem = new QTableWidgetItem( aType );
myTable->setItem( aRow, 0, aTypeItem );
// "Coefficient" column
void HYDROGUI_StricklerTableDlg::updateControls()
{
bool isTableNotEmpty = myTable->rowCount() > 0;
-- myClearBtn->setEnabled( isTableNotEmpty );
++ myClearBtn->setEnabled( isTableNotEmpty );
onSelectionChanged();
}
// Set default type (=> generate unique type name) and coefficient
//...
-- updateControls();
++ updateControls();
}
/**
QDockWidget* WindowDock( QWidget* wid );
- QStringList FindExistingObjectsNames( const Handle_HYDROData_Document& theDoc,
- QStringList FindExistingObjectsNames( const Handle(HYDROData_Document)& theDoc,
-- const ObjectKind theObjectKind,
++ QStringList FindExistingObjectsNames( const Handle(HYDROData_Document)& theDoc,
++ const ObjectKind theObjectKind,
bool isCheckValidProfile = false );
QString GetCoordinateString( const double theNumber, bool isInLocale );
--
- Handle_Image_PixMap Pixmap( const QImage& theImage );
++
+ Handle(Image_PixMap) Pixmap( const QImage& theImage );
void GetObjectReferences( const Handle(HYDROData_Entity)& theObj,
HYDROData_SequenceOfObjects& theRefObjects,
case KIND_SHAPES_GROUP:
sipClass = sipClass_HYDROData_ShapesGroup;
break;
--
++
case KIND_SPLIT_GROUP:
sipClass = sipClass_HYDROData_SplitShapesGroup;
break;
*/
virtual bool CanBeUpdated() const;
--
++
/**
* Checks is object exists in the data structure.
* \returns true is object is not exists in the data model
* Returns father object. For object created under root document label
* this method always return NULL object.
*/
- HYDROData_Entity GetFatherObject() const [Handle_HYDROData_Entity ()];
+ HYDROData_Entity GetFatherObject() const [opencascade::handle<HYDROData_Entity> ()];
%MethodCode
Handle(HYDROData_Entity) aFather;
--
++
Py_BEGIN_ALLOW_THREADS
-- aFather = sipSelfWasArg ? sipCpp->HYDROData_Entity::GetFatherObject() :
++ aFather = sipSelfWasArg ? sipCpp->HYDROData_Entity::GetFatherObject() :
sipCpp->GetFatherObject();
Py_END_ALLOW_THREADS
--
++
sipRes = createPointer( aFather );
%End
*/
virtual void RemoveZLevel();
-
+ void SetColor( const QColor& theColor, const int theTag = 0 );
+
protected:
/**
-- * Creates new object in the internal data structure. Use higher level objects
++ * Creates new object in the internal data structure. Use higher level objects
* to create objects with real content.
*/
HYDROData_Entity( Geometry );
* Destructs properties of the object and object itself, removes it from the document.
*/
virtual ~HYDROData_Entity();
--
++
};
test_HYDROGUI_ListModel.h
test_HYDROGUI_Shape.h
test_HYDROGUI_LandCoverMapDlg.h
-
+ test_HYDROData_CalcCase.h
+ test_HYDROData_Stream.h
+ test_HYDROData_Tool.h
+ test_HYDROGUI_BathymetryPrs.h
++
test_Dependencies.h
+ test_HYDROData_DTM.h
+ test_HYDROData_BoundaryPolygons.h
+ test_GraphicsView.h
+ test_Overview.h
TestShape.h
TestViewer.h
test_HYDROGUI_ListModel.cxx
test_HYDROGUI_Shape.cxx
test_HYDROGUI_LandCoverMapDlg.cxx
+ test_HYDROData_CalcCase.cxx
+ test_HYDROData_Stream.cxx
test_Dependencies.cxx
-
+ test_HYDROData_Tool.cxx
+ test_GraphicsView.cxx
+ test_Overview.cxx
+ test_HYDROGUI_ProfilesDlg.cxx
+ test_HYDROGUI_BathymetryPrs.cxx
+
TestShape.cxx
TestViewer.cxx
TestLib_Listener.cxx
../HYDROGUI/HYDROGUI_StricklerTableDlg.cxx
../HYDROGUI/HYDROGUI_LineEditDoubleValidator.cxx
../HYDROGUI/HYDROGUI_Tool.cxx
+ ../HYDROGUI/HYDROGUI_StreamDlg.cxx
+ ../HYDROGUI/HYDROGUI_ListSelector.cxx
+ ../HYDROGUI/HYDROGUI_OrderedListWidget.cxx
+ ../HYDROGUI/HYDROGUI_Overview.cxx
+ ../HYDROGUI/HYDROGUI_ZoneTool.cxx
+ ../HYDROGUI/HYDROGUI_ProfileDlg.cxx
+ ../HYDROGUI/HYDROGUI_ViewerDlg.cxx
+ ../HYDROGUI/HYDROGUI_AISTrihedron.cxx
+ ../HYDROGUI/HYDROGUI_CurveCreatorProfile.cxx
)
--set( MOC_HEADERS
++set( MOC_HEADERS
../HYDROGUI/HYDROGUI_InputPanel.h
../HYDROGUI/HYDROGUI_StricklerTableDlg.h
+ ../HYDROGUI/HYDROGUI_StreamDlg.h
+ ../HYDROGUI/HYDROGUI_ListSelector.h
+ ../HYDROGUI/HYDROGUI_OrderedListWidget.h
+ ../HYDROGUI/HYDROGUI_Overview.h
+ ../HYDROGUI/HYDROGUI_ZoneTool.h
+ ../HYDROGUI/HYDROGUI_ProfileDlg.h
+ ../HYDROGUI/HYDROGUI_ViewerDlg.h
)
- IF (SalomeGUI_VERSION VERSION_LESS "8.0.0")
- QT4_WRAP_CPP( PROJECT_MOC_HEADERS ${MOC_HEADERS} )
- ELSE()
- QT_WRAP_MOC( PROJECT_MOC_HEADERS ${MOC_HEADERS} )
- ENDIF()
+ #QT5_WRAP_MOC( PROJECT_MOC_HEADERS ${MOC_HEADERS} )
// Create the event manager and test controller
CppUnit::TestResult controller;
- // Add a listener that colllects test result
+ // Add a listener that collects test result
CppUnit::TestResultCollector result;
-- controller.addListener( &result );
++ controller.addListener( &result );
// Add a listener that print dots as test run.
TestLib_Listener progress;
-- controller.addListener( &progress );
++ controller.addListener( &progress );
-- CppUnit::TestFactoryRegistry& registry =
++ CppUnit::TestFactoryRegistry& registry =
CppUnit::TestFactoryRegistry::getRegistry();
// Add the top suite to the test runner
TestLib_Runner runner;
+ #ifdef WIN32
QString aPath = qgetenv( "HYDRO_SRC_DIR" ) + "/src/tests.cfg";
+ #else
+ QString aPath = qgetenv( "HYDRO_ROOT_DIR" ) + "/tests.cfg";
+ #endif
runner.Load( aPath.toStdString() );
-- runner.addTest( registry.makeTest() );
++ runner.addTest( registry.makeTest() );
try
{
std::cout << "Running tests " << testPath << "..." << std::endl;
}
catch ( std::invalid_argument &e ) // Test path not resolved
{
-- std::cerr << std::endl
++ std::cerr << std::endl
<< "ERROR: " << e.what()
<< std::endl;
return 0;