// Created on: 1995-08-09
// Created by: Arnaud BOUZY/Odile Olivier
// Copyright (c) 1995-1999 Matra Datavision
-// Copyright (c) 1999-2012 OPEN CASCADE SAS
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
+// This file is part of Open CASCADE Technology software library.
//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+#include <AIS_Point.hxx>
-#define GER61351 //GG_171199 Enable to set an object RGB color
-// instead a restricted object NameOfColor.
-
-#include <AIS_Point.ixx>
+#include <AIS_InteractiveContext.hxx>
#include <Aspect_TypeOfLine.hxx>
+#include <BRepBuilderAPI_MakeVertex.hxx>
+#include <Geom_Point.hxx>
+#include <Graphic3d_ArrayOfPoints.hxx>
+#include <Graphic3d_AspectMarker3d.hxx>
+#include <Graphic3d_Group.hxx>
+#include <Graphic3d_Structure.hxx>
#include <Prs3d_Drawer.hxx>
#include <Prs3d_PointAspect.hxx>
-#include <Graphic3d_Structure.hxx>
-#include <Graphic3d_Group.hxx>
+#include <Prs3d_Presentation.hxx>
#include <Quantity_Color.hxx>
-#include <Graphic3d_Vertex.hxx>
-#include <Graphic3d_AspectMarker3d.hxx>
-#include <SelectMgr_EntityOwner.hxx>
-#include <SelectBasics_EntityOwner.hxx>
#include <Select3D_SensitivePoint.hxx>
+#include <SelectMgr_EntityOwner.hxx>
+#include <Standard_Type.hxx>
#include <StdPrs_Point.hxx>
-#include <Geom_Point.hxx>
-#include <BRepBuilderAPI_MakeVertex.hxx>
-#include <AIS_Drawer.hxx>
+#include <TopoDS_Vertex.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(AIS_Point,AIS_InteractiveObject)
-#include <AIS_InteractiveContext.hxx>
//=======================================================================
//function : AIS_Point
//purpose :
myHasTOM(Standard_False),
myTOM(Aspect_TOM_PLUS)
{
- myHilightMode=-99;
+ myHilightDrawer = new Prs3d_Drawer();
+ myHilightDrawer->SetDisplayMode (-99);
+ myHilightDrawer->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_PLUS, Quantity_NOC_GRAY80, 3.0));
+ myHilightDrawer->SetColor (Quantity_NOC_GRAY80);
+ myHilightDrawer->SetZLayer (Graphic3d_ZLayerId_UNKNOWN);
+ myDynHilightDrawer = new Prs3d_Drawer();
+ myDynHilightDrawer->SetDisplayMode (-99);
+ myDynHilightDrawer->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_PLUS, Quantity_NOC_CYAN1, 3.0));
+ myDynHilightDrawer->SetColor (Quantity_NOC_CYAN1);
+ myDynHilightDrawer->SetZLayer (Graphic3d_ZLayerId_Top);
}
//=======================================================================
const Handle(Prs3d_Presentation)& aPresentation,
const Standard_Integer aMode)
{
- aPresentation->Clear();
-
aPresentation->SetInfiniteState(myInfiniteState);
if (aMode==0)
StdPrs_Point::Add(aPresentation,myComponent,myDrawer);
else if (aMode== -99)
{
- // Beeurk.. a revoir - rob-25/04/97
- static Handle(Graphic3d_AspectMarker3d) PtA =
- new Graphic3d_AspectMarker3d ();
- PtA->SetType(Aspect_TOM_PLUS);
- PtA->SetScale(3.);
Handle(Graphic3d_Group) TheGroup = Prs3d_Root::CurrentGroup(aPresentation);
- TheGroup->SetPrimitivesAspect(PtA);
- Graphic3d_Vertex Vtx(myComponent->X(),myComponent->Y(),myComponent->Z());
- TheGroup->Marker(Vtx);
+ TheGroup->SetPrimitivesAspect (myHilightDrawer->PointAspect()->Aspect());
+ Handle(Graphic3d_ArrayOfPoints) aPoint = new Graphic3d_ArrayOfPoints (1);
+ aPoint->AddVertex (myComponent->X(),myComponent->Y(),myComponent->Z());
+ TheGroup->AddPrimitiveArray (aPoint);
}
}
-//=======================================================================
-//function : Compute
-//purpose :
-//=======================================================================
-
-void AIS_Point::Compute(const Handle_Prs3d_Projector& aProjector,
- const Handle_Geom_Transformation& aTransformation,
- const Handle_Prs3d_Presentation& aPresentation)
-{
-// Standard_NotImplemented::Raise("AIS_Point::Compute(const Handle_Prs3d_Projector&, const Handle_Geom_Transformation&, const Handle_Prs3d_Presentation&)");
- PrsMgr_PresentableObject::Compute( aProjector , aTransformation , aPresentation) ;
-}
-
//=======================================================================
//function : ComputeSelection
//purpose :
const Standard_Integer /*aMode*/)
{
Handle(SelectMgr_EntityOwner) eown = new SelectMgr_EntityOwner(this,10);
-// eown -> SelectBasics_EntityOwner::Set(5);
Handle(Select3D_SensitivePoint) sp = new Select3D_SensitivePoint(eown,
myComponent->Pnt());
aSelection->Add(sp);
//=======================================================================
//function : SetColor
-//purpose :
+//purpose :
//=======================================================================
-
-void AIS_Point::SetColor(const Quantity_NameOfColor aCol)
-#ifdef GER61351
-{
- SetColor(Quantity_Color(aCol));
-}
-
-void AIS_Point::SetColor(const Quantity_Color &aCol)
-#endif
+void AIS_Point::SetColor (const Quantity_Color& theCol)
{
hasOwnColor=Standard_True;
- myOwnColor=aCol;
+ myDrawer->SetColor (theCol);
UpdatePointValues();
}
return BRepBuilderAPI_MakeVertex(P);
}
-
-//=======================================================================
-//function : Compute
-//purpose : to avoid warning
-//=======================================================================
-void AIS_Point::Compute(const Handle(Prs3d_Projector)&,
- const Handle(Prs3d_Presentation)&)
-{
-}
-
//=======================================================================
//function : SetMarker
//purpose :
//purpose :
//=======================================================================
- Standard_Boolean AIS_Point::
-AcceptDisplayMode(const Standard_Integer aMode) const
-{return aMode == 0;}
+ Standard_Boolean AIS_Point::AcceptDisplayMode (const Standard_Integer theMode) const
+{
+ return theMode == 0
+ || theMode == -99;
+}
+
+//=======================================================================
+//function : replaceWithNewPointAspect
+//purpose :
+//=======================================================================
+void AIS_Point::replaceWithNewPointAspect (const Handle(Prs3d_PointAspect)& theAspect)
+{
+ if (!myDrawer->HasLink())
+ {
+ myDrawer->SetPointAspect (theAspect);
+ return;
+ }
+ const Handle(Graphic3d_AspectMarker3d) anAspectOld = myDrawer->PointAspect()->Aspect();
+ const Handle(Graphic3d_AspectMarker3d) anAspectNew = !theAspect.IsNull() ? theAspect->Aspect() : myDrawer->Link()->PointAspect()->Aspect();
+ if (anAspectNew != anAspectOld)
+ {
+ myDrawer->SetPointAspect (theAspect);
+ Graphic3d_MapOfAspectsToAspects aReplaceMap;
+ aReplaceMap.Bind (anAspectOld, anAspectNew);
+ replaceAspects (aReplaceMap);
+ }
+}
//=======================================================================
//function : UpdatePointValues
void AIS_Point::UpdatePointValues()
{
-
- if(!hasOwnColor && myOwnWidth==0.0 && !myHasTOM){
- myDrawer->PointAspect().Nullify();
+ if (!hasOwnColor
+ && myOwnWidth == 0.0f
+ && !myHasTOM)
+ {
+ replaceWithNewPointAspect (Handle(Prs3d_PointAspect)());
return;
}
-#ifdef GER61351
- Quantity_Color aCol;
-#else
- Quantity_NameOfColor aCol;
-#endif
- Quantity_Color QCO;
- Aspect_TypeOfMarker aTOM;
- Standard_Real aScale;
-
- if(myDrawer->HasLink()){
- myDrawer->Link()->PointAspect()->Aspect()->Values(QCO,aTOM,aScale);
- aCol = QCO.Name();
- }
- else{
- aCol = Quantity_NOC_YELLOW;
- aTOM = Aspect_TOM_PLUS;
- aScale = 1;
+
+ Quantity_Color aCol (Quantity_NOC_YELLOW);
+ Aspect_TypeOfMarker aTOM = Aspect_TOM_PLUS;
+ Standard_Real aScale = 1.0;
+ if (myDrawer->HasLink())
+ {
+ aCol = myDrawer->Link()->PointAspect()->Aspect()->Color();
+ aTOM = myDrawer->Link()->PointAspect()->Aspect()->Type();
+ aScale = myDrawer->Link()->PointAspect()->Aspect()->Scale();
}
- if(hasOwnColor) aCol = myOwnColor;
- if(myOwnWidth!=0.0) aScale = myOwnWidth;
+
+ if(hasOwnColor) aCol = myDrawer->Color();
+ if(myOwnWidth != 0.0f) aScale = myOwnWidth;
if(myHasTOM) aTOM = myTOM;
-
-
- if(myDrawer->HasPointAspect()){
- // CLE
- // const Handle(Prs3d_PointAspect) PA = myDrawer->PointAspect();
+
+ if(myDrawer->HasOwnPointAspect())
+ {
Handle(Prs3d_PointAspect) PA = myDrawer->PointAspect();
- // ENDCLE
PA->SetColor(aCol);
PA->SetTypeOfMarker(aTOM);
PA->SetScale(aScale);
+ SynchronizeAspects();
}
else
- myDrawer->SetPointAspect(new Prs3d_PointAspect(aTOM,aCol,aScale));
+ {
+ replaceWithNewPointAspect (new Prs3d_PointAspect (aTOM, aCol, aScale));
+ }
}