Loading files
b8f597c67This file is pinned to the selected release. Download the original to open it in your design tool.
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// 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.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <IFSelect_GraphCounter.hxx>
#include <IFSelect_SelectDeduct.hxx>
#include <IFSelect_SelectPointed.hxx>
#include <Interface_EntityIterator.hxx>
#include <Interface_Graph.hxx>
#include <Standard_Type.hxx>
#include <cstdio>
IMPLEMENT_STANDARD_RTTIEXT(IFSelect_GraphCounter, IFSelect_SignCounter)
IFSelect_GraphCounter::IFSelect_GraphCounter(const bool withmap, const bool withlist)
: IFSelect_SignCounter(withmap, withlist)
{
}
occ::handle<IFSelect_SelectDeduct> IFSelect_GraphCounter::Applied() const
{
return theapplied;
}
void IFSelect_GraphCounter::SetApplied(const occ::handle<IFSelect_SelectDeduct>& applied)
{
theapplied = applied;
}
void IFSelect_GraphCounter::AddWithGraph(
const occ::handle<NCollection_HSequence<occ::handle<Standard_Transient>>>& list,
const Interface_Graph& graph)
{
if (theapplied.IsNull())
{
AddList(list, graph.Model());
return;
}
if (list.IsNull())
{
return;
}
int i, nb = list->Length();
for (i = 1; i <= nb; i++)
{
char val[12];
occ::handle<Standard_Transient> ent = list->Value(i);
theapplied->Alternate()->SetEntity(ent);
Interface_EntityIterator iter = theapplied->UniqueResult(graph);
int n = iter.NbEntities();
switch (n)
{
case 0:
Add(ent, "0");
break;
case 1:
Add(ent, "1");
break;
case 2:
Add(ent, "2");
break;
case 3:
Add(ent, "3");
break;
case 4:
Add(ent, "4");
break;
case 5:
Add(ent, "5");
break;
case 6:
Add(ent, "6");
break;
case 7:
Add(ent, "7");
break;
case 8:
Add(ent, "8");
break;
case 9:
Add(ent, "9");
break;
default:
Sprintf(val, "%d", n);
Add(ent, val);
break;
}
}
}