}
}
-void HYDROData_IPolyline::getSectionColor( const int theSectionIndex,
- QColor& theColor,
- const bool theIsCreate ) const
+bool HYDROData_IPolyline::getSectionColor( const int theSectionIndex, QColor &theColor) const
{
- TDF_Label aLabel = myLab.FindChild( DataTag_SectionColors, theIsCreate );
+ TDF_Label aLabel = myLab.FindChild( DataTag_SectionColors, false );
if ( aLabel.IsNull() )
- return;
+ return false;
- TDF_Label aSectLabel = aLabel.FindChild( theSectionIndex, theIsCreate );
+ TDF_Label aSectLabel = aLabel.FindChild( theSectionIndex, false );
if ( aSectLabel.IsNull() )
- return;
+ return false;
Handle(TDataStd_IntegerArray) aColorArray;
- if (theIsCreate)
- {
- if ( !aSectLabel.FindAttribute( TDataStd_IntegerArray::GetID(), aColorArray ) )
- aColorArray = TDataStd_IntegerArray::Set( aSectLabel, 1, 4 );
- aColorArray->SetValue( 1, theColor.red() );
- aColorArray->SetValue( 2, theColor.green() );
- aColorArray->SetValue( 3, theColor.blue() );
- aColorArray->SetValue( 4, theColor.alpha() );
- }
- else
+ if ( aSectLabel.FindAttribute( TDataStd_IntegerArray::GetID(), aColorArray ) )
{
- Handle(TDataStd_IntegerArray) aColorArray;
- if ( aSectLabel.FindAttribute( TDataStd_IntegerArray::GetID(), aColorArray ) )
- {
- theColor.setRed( aColorArray->Value( 1 ) );
- theColor.setGreen( aColorArray->Value( 2 ) );
- theColor.setBlue( aColorArray->Value( 3 ) );
- theColor.setAlpha( aColorArray->Value( 4 ) );
- }
+ theColor.setRed( aColorArray->Value( 1 ) );
+ theColor.setGreen( aColorArray->Value( 2 ) );
+ theColor.setBlue( aColorArray->Value( 3 ) );
+ theColor.setAlpha( aColorArray->Value( 4 ) );
}
}
+void HYDROData_IPolyline::setSectionColor( const int theSectionIndex,
+ const QColor& theColor ) const
+{
+ TDF_Label aLabel = myLab.FindChild( DataTag_SectionColors, true );
+ if ( aLabel.IsNull() )
+ return;
+
+ TDF_Label aSectLabel = aLabel.FindChild( theSectionIndex, true );
+ if ( aSectLabel.IsNull() )
+ return;
+
+ Handle(TDataStd_IntegerArray) aColorArray;
+
+ if ( !aSectLabel.FindAttribute( TDataStd_IntegerArray::GetID(), aColorArray ) )
+ aColorArray = TDataStd_IntegerArray::Set( aSectLabel, 1, 4 );
+
+ aColorArray->SetValue( 1, theColor.red() );
+ aColorArray->SetValue( 2, theColor.green() );
+ aColorArray->SetValue( 3, theColor.blue() );
+ aColorArray->SetValue( 4, theColor.alpha() );
+}
+
void HYDROData_IPolyline::removeSectionColor( const int theSectionIndex ) const
{
TDF_Label aLabel = myLab.FindChild( DataTag_SectionColors, false );
Quantity_Color aColor = CurveCreator_Utils::getRandColor();
QColor aQColor = CurveCreator_Utils::colorConv(aColor);
- myEditedObject->getSectionColor(i-1, aQColor, false);
+ myEditedObject->getSectionColor(i-1, aQColor);
myCurve->addSectionInternal( aSectName.toStdString(),
aCurveType, aSectClosure, aCurveCoords, CurveCreator_Utils::colorConv(aQColor) );
aPolylineObj->AddSection( aSectName, aSectType, aSectClosure );
Quantity_Color aColor = myCurve->getColorSection(i);
- aPolylineObj->getSectionColor(i, CurveCreator_Utils::colorConv(aColor), true);
+ aPolylineObj->setSectionColor(i, CurveCreator_Utils::colorConv(aColor));
// Add the points from section
CurveCreator::Coordinates aCurveCoords = myCurve->getCoords( i );
Quantity_Color newOCCCol = HYDROData_Tool::toOccColor(newQCurCol);
aCurve->setColorSectionInternal(0, newOCCCol);
- //Handle(AIS_InteractiveObject) anAISObject = aCurve->getAISObject();
- //if (anAISObject)
- // anAISObject->SetColor(newOCCCol);
+ Handle(AIS_InteractiveObject) anAISObject = aCurve->getAISObject();
+ if (anAISObject)
+ {
+ //color points of shape in the same color as edges
+ Handle(Prs3d_PointAspect) anAspect = anAISObject->Attributes()->PointAspect();
+ anAspect->SetColor(newOCCCol);
+ anAISObject->Attributes()->SetPointAspect( anAspect );
+ }
QListWidgetItem* item = myProfileNames->item(theIndex);
QPixmap SPixmap(16, 16);