mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
Integration of OCCT 6.5.0 from SVN
This commit is contained in:
100
src/IGESSelect/IGESSelect.cdl
Executable file
100
src/IGESSelect/IGESSelect.cdl
Executable file
@@ -0,0 +1,100 @@
|
||||
-- File: IGESSelect.cdl
|
||||
-- Created: Tue May 31 13:36:04 1994
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@bravox>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
package IGESSelect
|
||||
|
||||
---Purpose : This package defines the library of the most used tools for
|
||||
-- IGES Files : Selections & Modifiers specific to the IGES norm,
|
||||
-- and the most needed converters
|
||||
|
||||
uses MMgt, TCollection, TColStd, Dico, Message,
|
||||
Geom, Interface, IFGraph, IFSelect, IGESData
|
||||
|
||||
is
|
||||
|
||||
class EditHeader;
|
||||
class EditDirPart;
|
||||
|
||||
class IGESTypeForm;
|
||||
class IGESName;
|
||||
class SignStatus;
|
||||
class SignLevelNumber;
|
||||
class SignColor;
|
||||
|
||||
class CounterOfLevelNumber;
|
||||
class ViewSorter;
|
||||
|
||||
class DispPerSingleView; -- Packets for SingleViews (+ Drawing Frame)
|
||||
class DispPerDrawing; -- Packets for Drawings
|
||||
|
||||
class SelectVisibleStatus; -- Select visible or blanked entities
|
||||
class SelectSubordinate; -- Select according Subordinate Status
|
||||
class SelectLevelNumber; -- Select according a level number
|
||||
class SelectName; -- Select according Name (Short/Name Property)
|
||||
|
||||
class SelectFromSingleView; -- Select items associated with some views
|
||||
class SelectFromDrawing; -- Select items concerned by some drawings
|
||||
class SelectSingleViewFrom; -- Pick single views attached to some items
|
||||
class SelectDrawingFrom; -- Pick drawings which concern some items
|
||||
|
||||
class SelectBypassGroup; -- Select bypassing groups
|
||||
class SelectBypassSubfigure; -- Select bypassing subfigures
|
||||
class SelectBasicGeom; -- Select basic curves3d (drops surfaces,etc)
|
||||
class SelectFaces; -- Select some geometries : Faces
|
||||
class SelectPCurves; -- Select PCurves of Faces
|
||||
|
||||
|
||||
deferred class ModelModifier instantiates
|
||||
ModelModifier from IFSelect (IGESModel from IGESData, Protocol from IGESData);
|
||||
deferred class FileModifier instantiates
|
||||
FileModifier from IFSelect (IGESWriter from IGESData);
|
||||
|
||||
class FloatFormat; -- File Modifier to control Float Format
|
||||
class AddFileComment; -- " " to add comment start lines
|
||||
|
||||
class UpdateFileName; -- Set new file name
|
||||
class UpdateCreationDate; -- Set new creation date
|
||||
class UpdateLastChange; -- Set new last change date
|
||||
class SetVersion5; -- Set the version to IGES5 (with LastChange)
|
||||
class SetGlobalParameter; -- Set the value of a global parameter
|
||||
|
||||
class AutoCorrect; -- Does the absolutely evident corrections
|
||||
class ComputeStatus; -- Recompute SubordinateStatus & UseFlag
|
||||
class RebuildDrawings; -- Rebuild drawings in transferred models
|
||||
class RebuildGroups; -- Rebuild groups in transferred models
|
||||
class AddGroup; -- Adds a Group with slected entities
|
||||
|
||||
class ChangeLevelNumber; -- Changes Level Number (single) to new value
|
||||
class ChangeLevelList; -- Changes Level List to single Level Number
|
||||
|
||||
class SplineToBSpline; -- Convert Spline(112/126) to BSpline(114/128)
|
||||
|
||||
class RemoveCurves; -- Remove Curves on Surface (141..144)
|
||||
class SetLabel; -- Sets or Clears ShortLabel
|
||||
|
||||
class WorkLibrary;
|
||||
class Activator;
|
||||
class Dumper;
|
||||
|
||||
Run;
|
||||
---Purpose : Simply gives a prompt for a conversational action on standard
|
||||
-- input/output. Returns the status of a
|
||||
|
||||
WhatIges (ent : IGESEntity from IGESData; G : Graph from Interface;
|
||||
sup : out IGESEntity from IGESData; index : out Integer)
|
||||
returns Integer;
|
||||
---Purpose : Gives a quick analysis of an IGES Entity in the context of a
|
||||
-- model (i.e. a File) described by a Graph.
|
||||
-- Returned values are :
|
||||
-- <sup> : the most meaningfull super entity, if any (else Null)
|
||||
-- <index> : meaningfull index relating to super entity, if any
|
||||
-- <returned> : a status which helps exploitation of <sup>, by
|
||||
-- giving a case
|
||||
-- (normally, types of <ent> and <sup> should suffice to
|
||||
-- known the case)
|
||||
|
||||
end IGESSelect;
|
42
src/IGESSelect/IGESSelect.cxx
Executable file
42
src/IGESSelect/IGESSelect.cxx
Executable file
@@ -0,0 +1,42 @@
|
||||
#include <IGESSelect.ixx>
|
||||
#include <IFSelect_Functions.hxx>
|
||||
#include <IFSelect_SessionPilot.hxx>
|
||||
#include <IGESSelect_Activator.hxx>
|
||||
#include <IFSelect_WorkSession.hxx>
|
||||
#include <IFSelect_ShareOut.hxx>
|
||||
#include <IGESSelect_WorkLibrary.hxx>
|
||||
|
||||
#include <IGESData_IGESEntity.hxx>
|
||||
#include <IGESData_IGESModel.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
|
||||
|
||||
void IGESSelect::Run ()
|
||||
{
|
||||
// Handle(IFSelect_BasicActivator) Activator = new IFSelect_BasicActivator;
|
||||
IFSelect_Functions::Init();
|
||||
Handle(IFSelect_SessionPilot) pilot = new IFSelect_SessionPilot("XSTEP-IGES>");
|
||||
Handle(IGESSelect_Activator) igesact = new IGESSelect_Activator;
|
||||
pilot->SetSession (new IFSelect_WorkSession ( ));
|
||||
pilot->SetLibrary (new IGESSelect_WorkLibrary);
|
||||
|
||||
pilot->ReadScript();
|
||||
}
|
||||
|
||||
|
||||
Standard_Integer IGESSelect::WhatIges
|
||||
(const Handle(IGESData_IGESEntity)& ent, const Interface_Graph& G,
|
||||
Handle(IGESData_IGESEntity)& /* sup */, Standard_Integer& /* index */)
|
||||
{
|
||||
DeclareAndCast(IGESData_IGESEntity,igesent,ent);
|
||||
if (igesent.IsNull()) return Standard_False;
|
||||
// Standard_Integer igt = igesent->TypeNumber();
|
||||
DeclareAndCast(IGESData_IGESModel,model,G.Model());
|
||||
if (igesent.IsNull() || model.IsNull()) return 0;
|
||||
|
||||
// Plane : de View ? de SingleParent ? sinon cf TrimmedSurface & cie
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
27
src/IGESSelect/IGESSelect_Activator.cdl
Executable file
27
src/IGESSelect/IGESSelect_Activator.cdl
Executable file
@@ -0,0 +1,27 @@
|
||||
-- File: IGESSelect_Activator.cdl
|
||||
-- Created: Fri Jun 3 09:34:52 1994
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@meteox>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
class Activator from IGESSelect inherits Activator from IFSelect
|
||||
|
||||
---Purpose : Performs Actions specific to IGESSelect, i.e. creation of
|
||||
-- IGES Selections and Dispatches, plus dumping specific to IGES
|
||||
|
||||
uses CString, SessionPilot, ReturnStatus
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable Activator from IGESSelect;
|
||||
|
||||
|
||||
Do (me : mutable; number : Integer; pilot : mutable SessionPilot)
|
||||
returns ReturnStatus;
|
||||
---Purpose : Executes a Command Line for IGESSelect
|
||||
|
||||
Help (me; number : Integer) returns CString;
|
||||
---Purpose : Sends a short help message for IGESSelect commands
|
||||
|
||||
end Activator;
|
432
src/IGESSelect/IGESSelect_Activator.cxx
Executable file
432
src/IGESSelect/IGESSelect_Activator.cxx
Executable file
@@ -0,0 +1,432 @@
|
||||
#include <Standard_ErrorHandler.hxx>
|
||||
#include <Standard_Failure.hxx>
|
||||
|
||||
#include <IGESSelect_Activator.ixx>
|
||||
#include <Interface_EntityIterator.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
#include <IFSelect_WorkSession.hxx>
|
||||
#include <IFSelect_WorkLibrary.hxx>
|
||||
|
||||
#include <IGESData_IGESModel.hxx>
|
||||
#include <IGESData_IGESEntity.hxx>
|
||||
#include <IGESData_Protocol.hxx>
|
||||
#include <IFSelect_IntParam.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
|
||||
#include <IGESSelect_IGESTypeForm.hxx>
|
||||
|
||||
#include <IGESSelect_ViewSorter.hxx>
|
||||
#include <IFSelect_PacketList.hxx>
|
||||
|
||||
#include <IGESSelect_DispPerSingleView.hxx>
|
||||
#include <IGESSelect_DispPerDrawing.hxx>
|
||||
|
||||
#include <IFSelect_SelectSignature.hxx>
|
||||
#include <IGESSelect_SelectVisibleStatus.hxx>
|
||||
#include <IGESSelect_SelectLevelNumber.hxx>
|
||||
#include <IGESSelect_SelectName.hxx>
|
||||
|
||||
#include <IGESSelect_SelectFromSingleView.hxx>
|
||||
#include <IGESSelect_SelectFromDrawing.hxx>
|
||||
#include <IGESSelect_SelectSingleViewFrom.hxx>
|
||||
#include <IGESSelect_SelectDrawingFrom.hxx>
|
||||
|
||||
#include <IGESSelect_SelectBypassGroup.hxx>
|
||||
|
||||
#include <IGESSelect_FloatFormat.hxx>
|
||||
#include <IGESSelect_UpdateCreationDate.hxx>
|
||||
#include <IGESSelect_UpdateLastChange.hxx>
|
||||
#include <IGESSelect_UpdateFileName.hxx>
|
||||
#include <IGESSelect_SetVersion5.hxx>
|
||||
#include <IGESSelect_SetGlobalParameter.hxx>
|
||||
|
||||
#include <IGESSelect_AutoCorrect.hxx>
|
||||
#include <IGESSelect_ComputeStatus.hxx>
|
||||
#include <IGESSelect_RebuildDrawings.hxx>
|
||||
#include <IGESSelect_RebuildGroups.hxx>
|
||||
#include <IGESSelect_AddGroup.hxx>
|
||||
|
||||
#include <IGESSelect_SplineToBSpline.hxx>
|
||||
|
||||
#include <TColStd_HSequenceOfTransient.hxx>
|
||||
#include <IGESSelect_WorkLibrary.hxx>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
|
||||
static int initActivator = 0;
|
||||
|
||||
IGESSelect_Activator::IGESSelect_Activator ()
|
||||
{
|
||||
if (initActivator) return; initActivator = 1;
|
||||
// Add ( 0,"load");
|
||||
// Add ( 0,"loadiges"); // homonyme
|
||||
SetForGroup ("XSTEP-IGES");
|
||||
|
||||
Add ( 5,"listviews");
|
||||
Add ( 6,"listdrawings");
|
||||
Add ( 7,"listsviews");
|
||||
|
||||
AddSet (10,"igestype");
|
||||
AddSet (11,"bypassgroup");
|
||||
AddSet (12,"igesname");
|
||||
AddSet (13,"igesvisible");
|
||||
AddSet (14,"igeslevel");
|
||||
|
||||
AddSet (21,"igesfromdrawing");
|
||||
AddSet (22,"igesfromview");
|
||||
AddSet (23,"igesdrawingfrom");
|
||||
AddSet (24,"igesviewfrom");
|
||||
|
||||
AddSet (31,"igesdispdrawing");
|
||||
AddSet (32,"igesdispview");
|
||||
|
||||
AddSet (40,"floatformat");
|
||||
AddSet (41,"setglobalparam");
|
||||
AddSet (42,"setversion5");
|
||||
AddSet (43,"updatecreationdate");
|
||||
AddSet (44,"updatelastchange");
|
||||
AddSet (45,"updatefilename");
|
||||
|
||||
AddSet (50,"autocorrect");
|
||||
AddSet (51,"computestatus");
|
||||
AddSet (52,"rebuildgroups");
|
||||
AddSet (53,"rebuilddrawings");
|
||||
AddSet (54,"addgroup");
|
||||
|
||||
AddSet (60,"splinetobspline");
|
||||
|
||||
Add (70,"setuseflag");
|
||||
}
|
||||
|
||||
|
||||
IFSelect_ReturnStatus IGESSelect_Activator::Do
|
||||
(const Standard_Integer number,
|
||||
const Handle(IFSelect_SessionPilot)& pilot)
|
||||
{
|
||||
Standard_Integer argc = pilot->NbWords();
|
||||
const Standard_CString arg1 = pilot->Word(1).ToCString();
|
||||
const Standard_CString arg2 = pilot->Word(2).ToCString();
|
||||
// const Standard_CString arg3 = pilot->Word(3).ToCString();
|
||||
Handle(IFSelect_WorkSession) WS = pilot->Session();
|
||||
|
||||
switch (number) {
|
||||
|
||||
case 5 : // **** ListViews (sans tri complementaire)
|
||||
case 6 : // **** ListDrawings
|
||||
case 7 : { // **** ListS(ingle)Views
|
||||
Standard_Integer listmode = 0;
|
||||
if (argc == 2 && arg1[0] == '?') argc = -1;
|
||||
if (argc < 2) {
|
||||
cout<<"Ajouter un argument pour avoir :\n"<<
|
||||
" l : liste resumee"<<
|
||||
" c : liste complete par item (mais pas pour remaining)\n"<<
|
||||
" r : idem + liste complete remaining\n"<<
|
||||
" sur tout le modele. Ajouter nom selection pour lister sur une partie"<<endl;
|
||||
return (argc >= 0 ? IFSelect_RetError : IFSelect_RetVoid);
|
||||
}
|
||||
if (arg1[0] == 'l') {
|
||||
listmode = 0; cout<<"Liste resumee";
|
||||
}
|
||||
else if (arg1[0] == 'c') {
|
||||
listmode = 1; cout<<"Liste complete par item (pas pour Remaining)"<<endl;
|
||||
}
|
||||
else if (arg1[0] == 'r') {
|
||||
listmode = 2; cout<<"Liste complete par item et pour Remaining"<<endl;
|
||||
}
|
||||
else {
|
||||
cout<<"Parametre de listage non compris"<<endl; return IFSelect_RetError;
|
||||
}
|
||||
|
||||
Handle(IGESSelect_ViewSorter) vs = new IGESSelect_ViewSorter;
|
||||
vs->SetModel(GetCasted(IGESData_IGESModel,WS->Model()));
|
||||
if (argc == 2) vs->AddModel(WS->Model());
|
||||
else {
|
||||
// on demande une selection
|
||||
DeclareAndCast(IFSelect_Selection,sel,WS->NamedItem(arg2));
|
||||
if (sel.IsNull()) {
|
||||
cout<<"Pas une selection : "<<arg2<<endl;
|
||||
return IFSelect_RetError;
|
||||
}
|
||||
vs->AddList (WS->SelectionResult(sel));
|
||||
}
|
||||
Standard_Boolean listdr = (number > 5);
|
||||
if (number == 6) vs->SortDrawings(WS->Graph());
|
||||
if (number == 7) vs->SortSingleViews(Standard_True);
|
||||
Handle(IFSelect_PacketList) sets = vs->Sets(listdr);
|
||||
Standard_Integer nb = vs->NbSets(listdr);
|
||||
cout<<" -- ViewSorter for";
|
||||
if (number == 5) cout<<" Views & Drawings";
|
||||
if (number == 6) cout<<" Drawings only (complete)";
|
||||
if (number == 7) cout<<" Single Views & Drawing Frames";
|
||||
cout<<", on "<<vs->NbEntities()<<" ent.s, give "<<nb<<" Sets"<<endl;
|
||||
|
||||
Interface_EntityIterator iter;
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) {
|
||||
cout<<" -- Set n0 "<<i<<" Item=entity n0: "<<
|
||||
WS->Model()->Number(vs->SetItem(i,listdr))<<" List:";
|
||||
cout<<sets->NbEntities(i)<<" ent.s:"<<endl;
|
||||
if (listmode == 0) continue;
|
||||
iter = sets->Entities(i);
|
||||
WS->ListEntities (iter,0);
|
||||
}
|
||||
|
||||
cout <<" -- Remaining Entities (not yet sorted) :"
|
||||
<<sets->NbDuplicated(0,Standard_False)<<endl;
|
||||
if (listmode < 2) return IFSelect_RetVoid;
|
||||
iter = sets->Duplicated(0,Standard_False);
|
||||
WS->ListEntities(iter,0);
|
||||
return IFSelect_RetVoid;
|
||||
}
|
||||
|
||||
case 10 : { // **** IGESType (form Type/Form)
|
||||
if (argc < 2) {
|
||||
cout<<"Donner le n0 de type desire, + en option la forme\n"
|
||||
<<" Si pas de forme, prend toutes les formes du type demande"<<endl;
|
||||
return IFSelect_RetError;
|
||||
}
|
||||
char signature[20];
|
||||
if (argc == 2) sprintf(signature,"%s",arg1);
|
||||
else sprintf(signature,"%s %s",arg1,arg2);
|
||||
Handle(IFSelect_SelectSignature) sel = new IFSelect_SelectSignature
|
||||
(new IGESSelect_IGESTypeForm, signature,(argc > 2));
|
||||
return pilot->RecordItem (sel);
|
||||
}
|
||||
|
||||
case 11 : { // **** IGES BypassGroup
|
||||
return pilot->RecordItem (new IGESSelect_SelectBypassGroup);
|
||||
}
|
||||
|
||||
case 12 : { // **** IGES Name
|
||||
if (argc < 2) {
|
||||
cout<<"Donner un Nom de TextParam pour IGESName"<<endl;
|
||||
return IFSelect_RetError;
|
||||
}
|
||||
Handle(IGESSelect_SelectName) sel = new IGESSelect_SelectName;
|
||||
sel->SetName
|
||||
(GetCasted(TCollection_HAsciiString,WS->NamedItem(arg1)) );
|
||||
return pilot->RecordItem (sel);
|
||||
}
|
||||
|
||||
case 13 : { // **** IGES VisibleStatus
|
||||
return pilot->RecordItem (new IGESSelect_SelectVisibleStatus);
|
||||
}
|
||||
|
||||
case 14 : { // **** IGES LevelNumber
|
||||
if (argc < 2) {
|
||||
cout<<"Donner nom IntParam pour Level"<<endl;
|
||||
return IFSelect_RetError;
|
||||
}
|
||||
DeclareAndCast(IFSelect_IntParam,lev,WS->NamedItem(arg1));
|
||||
if (lev.IsNull()) {
|
||||
cout<<arg1<<" : pas un IntParam (pour Level)"<<endl;
|
||||
return IFSelect_RetError;
|
||||
}
|
||||
Handle(IGESSelect_SelectLevelNumber) sel = new IGESSelect_SelectLevelNumber;
|
||||
sel->SetLevelNumber(lev);
|
||||
return pilot->RecordItem (sel);
|
||||
}
|
||||
|
||||
case 21 : { // **** IGES FromDrawing
|
||||
return pilot->RecordItem (new IGESSelect_SelectFromDrawing);
|
||||
}
|
||||
case 22 : { // **** IGES FromSingleView
|
||||
return pilot->RecordItem (new IGESSelect_SelectFromSingleView);
|
||||
}
|
||||
case 23 : { // **** IGES FromDrawing
|
||||
return pilot->RecordItem (new IGESSelect_SelectDrawingFrom);
|
||||
}
|
||||
case 24 : { // **** IGES FromDrawing
|
||||
return pilot->RecordItem (new IGESSelect_SelectSingleViewFrom);
|
||||
}
|
||||
|
||||
case 31 : { // **** IGES DispatchPerDrawing
|
||||
return pilot->RecordItem (new IGESSelect_DispPerDrawing);
|
||||
}
|
||||
case 32 : { // **** IGES DispatchPerSingleView
|
||||
return pilot->RecordItem (new IGESSelect_DispPerSingleView);
|
||||
}
|
||||
|
||||
case 40 : { // **** FloatFormat
|
||||
char prem = ' ';
|
||||
if (argc < 2) prem = '?';
|
||||
else if (argc == 5) {
|
||||
cout<<"floatformat tout court donne les formes admises"<<endl;
|
||||
return IFSelect_RetError;
|
||||
}
|
||||
else prem = arg1[0];
|
||||
Standard_Boolean zerosup=Standard_False;
|
||||
Standard_Integer digits = 0;
|
||||
if (prem == 'N' || prem == 'n') zerosup = Standard_False;
|
||||
else if (prem == 'Z' || prem == 'z') zerosup = Standard_True;
|
||||
else if (prem >= 48 && prem <= 57) digits = atoi(arg1);
|
||||
else {
|
||||
cout<<"floatformat digits, digits=nb de chiffres signifiants, ou\n"
|
||||
<< "floatformat NZ %mainformat [%rangeformat [Rmin Rmax]]\n"
|
||||
<<" NZ : N ou n pour Non-zero-suppress, Z ou z pour zero-suppress\n"
|
||||
<<" %mainformat : format principal type printf, ex,: %E\n"
|
||||
<<" + optionnel : format secondaire (flottants autour de 1.) :\n"
|
||||
<<" %rangeformat Rmin Rmax : format type printf entre Rmin et Rmax\n"
|
||||
<<" %rangeformat tout seul : format type printf entre 0.1 et 1000.\n"
|
||||
<<flush;
|
||||
return (prem == '?' ? IFSelect_RetVoid : IFSelect_RetError);
|
||||
}
|
||||
Standard_Real Rmin=0., Rmax=0.;
|
||||
if (argc > 4) {
|
||||
Rmin = atof(pilot->Word(4).ToCString());
|
||||
Rmax = atof(pilot->Word(5).ToCString());
|
||||
if (Rmin <= 0 || Rmax <= 0) { cout<<"intervalle : donner reels > 0"<<endl; return IFSelect_RetError; }
|
||||
}
|
||||
Handle(IGESSelect_FloatFormat) fm = new IGESSelect_FloatFormat;
|
||||
if (argc == 2) fm->SetDefault(digits);
|
||||
else {
|
||||
fm->SetZeroSuppress(zerosup);
|
||||
fm->SetFormat (arg2);
|
||||
if (argc == 4) fm->SetFormatForRange(pilot->Word(3).ToCString());
|
||||
else if (argc >= 6) fm->SetFormatForRange(pilot->Word(3).ToCString(),Rmin,Rmax);
|
||||
else fm->SetFormatForRange("");
|
||||
}
|
||||
return pilot->RecordItem(fm);
|
||||
}
|
||||
|
||||
case 41 : { // **** SetGlobalParameter
|
||||
if (argc < 3) {
|
||||
cout<<"Donner entier=n0 param a changer + nom TextParam pour la valeur"<<endl;
|
||||
return IFSelect_RetError;
|
||||
}
|
||||
Standard_Integer numpar = atoi(arg1);
|
||||
if (numpar <= 0) {
|
||||
cout<<"Pas un n0 de param global correct:"<<arg1<<endl;
|
||||
return IFSelect_RetError;
|
||||
}
|
||||
DeclareAndCast(TCollection_HAsciiString,val,WS->NamedItem(arg2));
|
||||
if (val.IsNull()) {
|
||||
cout<<"Pas un nom de TextParam:"<<arg2<<endl;
|
||||
return IFSelect_RetError;
|
||||
}
|
||||
Handle(IGESSelect_SetGlobalParameter) mod =
|
||||
new IGESSelect_SetGlobalParameter(numpar);
|
||||
mod->SetValue(val);
|
||||
return pilot->RecordItem (mod);
|
||||
}
|
||||
|
||||
case 42 : { // **** Set IGES Version 5.1
|
||||
return pilot->RecordItem (new IGESSelect_SetVersion5);
|
||||
}
|
||||
case 43 : { // **** Update Creation Date
|
||||
return pilot->RecordItem (new IGESSelect_UpdateCreationDate);
|
||||
}
|
||||
case 44 : { // **** Update Last Change Date
|
||||
return pilot->RecordItem (new IGESSelect_UpdateLastChange);
|
||||
}
|
||||
case 45 : { // **** Update File Name
|
||||
return pilot->RecordItem (new IGESSelect_UpdateFileName);
|
||||
}
|
||||
|
||||
case 50 : { // **** AutoCorrect
|
||||
return pilot->RecordItem (new IGESSelect_AutoCorrect);
|
||||
}
|
||||
case 51 : { // **** Compute Status
|
||||
return pilot->RecordItem (new IGESSelect_ComputeStatus);
|
||||
}
|
||||
case 52 : { // **** Rebuild Groups
|
||||
return pilot->RecordItem (new IGESSelect_RebuildGroups);
|
||||
}
|
||||
case 53 : { // **** Rebuild Drawings
|
||||
return pilot->RecordItem (new IGESSelect_RebuildDrawings);
|
||||
}
|
||||
case 54 : { // **** Add Group
|
||||
return pilot->RecordItem (new IGESSelect_AddGroup);
|
||||
}
|
||||
|
||||
case 60 : { // **** Spline To BSpline
|
||||
if (argc < 2) {
|
||||
cout<<"Pour SplineToBSpline, donner mode :\n"<<
|
||||
" n pour normal, t pour tryC2"<<endl;
|
||||
return IFSelect_RetError;
|
||||
}
|
||||
Standard_Boolean tryC2;
|
||||
if (arg1[0] == 'n' || arg1[0] == 'N')
|
||||
tryC2 = Standard_False;
|
||||
else if (arg1[0] == 't' || arg1[0] == 'T')
|
||||
tryC2 = Standard_True;
|
||||
else {
|
||||
cout<<" Mode incorrect : "<<arg1<<endl;
|
||||
return IFSelect_RetError;
|
||||
}
|
||||
Handle(IGESSelect_SplineToBSpline) conv =
|
||||
new IGESSelect_SplineToBSpline (tryC2);
|
||||
return pilot->RecordItem(conv);
|
||||
}
|
||||
|
||||
case 70 : { // **** SetUseFlag
|
||||
Standard_Integer usefl = atoi (arg1);
|
||||
if (argc > 2) {
|
||||
Handle(TColStd_HSequenceOfTransient) list = WS->GiveList(pilot->CommandPart(2));
|
||||
Standard_Integer i, nb = list->Length();
|
||||
for (i = 1; i <= nb; i ++) {
|
||||
DeclareAndCast(IGESData_IGESEntity,ent,list->Value(i));
|
||||
if (!ent.IsNull()) ent->InitStatus
|
||||
(ent->BlankStatus(),ent->SubordinateStatus(),usefl,ent->HierarchyStatus());
|
||||
}
|
||||
}
|
||||
else {
|
||||
Standard_Integer i, nb = WS->NbStartingEntities();
|
||||
for (i = 1; i <= nb; i ++) {
|
||||
DeclareAndCast(IGESData_IGESEntity,ent,WS->StartingEntity(i));
|
||||
if (!ent.IsNull()) ent->InitStatus
|
||||
(ent->BlankStatus(),ent->SubordinateStatus(),usefl,ent->HierarchyStatus());
|
||||
}
|
||||
}
|
||||
return IFSelect_RetDone;
|
||||
}
|
||||
|
||||
default : break;
|
||||
}
|
||||
return IFSelect_RetVoid;
|
||||
|
||||
}
|
||||
|
||||
Standard_CString IGESSelect_Activator::Help
|
||||
(const Standard_Integer number) const
|
||||
{
|
||||
switch (number) {
|
||||
case 5 : return "Liste Vues (tous types). Nom selection sinon tout modele";
|
||||
case 6 : return "Liste Drawings. Nom selection sinon tout modele";
|
||||
case 7 : return "Liste Vues SIMPLES. Nom selection sinon tout modele";
|
||||
|
||||
case 10 : return "type:integer [form:integer] : cree Select IGESType";
|
||||
case 11 : return "cree Select Bypass Group";
|
||||
case 12 : return "name:TextParam : cree Select Name (Name/Label)";
|
||||
case 13 : return "cree Select Visible Status (Blank Status = 0 sinon 1)";
|
||||
case 14 : return "level:IntParam : cree Select LevelNumber";
|
||||
|
||||
case 21 : return "cree Select From Drawing";
|
||||
case 22 : return "cree Select From Single View";
|
||||
case 23 : return "cree Select Drawing From, drawing(s) pour une liste d entites";
|
||||
case 24 : return "cree Select View From, views pour une liste d entites";
|
||||
|
||||
case 31 : return "cree Dispatch Per Drawing";
|
||||
case 32 : return "cree Dispatch Per SingleView";
|
||||
|
||||
case 40 : return "options... : cree FloatFormat ... floatformat tout court->help";
|
||||
case 41 : return "numpar:integer value:TextParam : cree Set Global Param";
|
||||
case 42 : return "cree Set Version -> 5.1";
|
||||
case 43 : return "cree Update Creation Date";
|
||||
case 44 : return "cree Update Last Change Date";
|
||||
case 45 : return "cree Update File Name (dynamic)";
|
||||
|
||||
case 50 : return "cree AutoCorrect";
|
||||
case 51 : return "cree Compute Status (in D.E.)";
|
||||
case 52 : return "cree Rebuild Groups";
|
||||
case 53 : return "cree Rebuild Drawings";
|
||||
case 54 : return "cree AddGroup";
|
||||
|
||||
case 60 : return "cree SplineToBSpline Conversion";
|
||||
|
||||
case 70 : return "useflag givelist : Set Use Flag to value";
|
||||
|
||||
default : break;
|
||||
}
|
||||
return "??";
|
||||
}
|
56
src/IGESSelect/IGESSelect_AddFileComment.cdl
Executable file
56
src/IGESSelect/IGESSelect_AddFileComment.cdl
Executable file
@@ -0,0 +1,56 @@
|
||||
-- File: IGESSelect_AddFileComment.cdl
|
||||
-- Created: Fri Aug 26 11:33:48 1994
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@minox>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
class AddFileComment from IGESSelect inherits FileModifier from IGESSelect
|
||||
|
||||
---Purpose : This class allows to add comment lines on writing an IGES File
|
||||
-- These lines are added to Start Section, instead of the only
|
||||
-- one blank line written by default.
|
||||
|
||||
uses CString, AsciiString from TCollection,
|
||||
HSequenceOfHAsciiString from TColStd,
|
||||
IGESWriter , ContextWrite
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable AddFileComment;
|
||||
---Purpose : Creates a new emoty AddFileComment. Use AddLine to complete it
|
||||
|
||||
Clear (me : mutable);
|
||||
---Purpose : Clears the list of file comment lines already stored
|
||||
|
||||
AddLine (me : mutable; line : CString);
|
||||
---Purpose : Adds a line for file comment
|
||||
-- Remark : Lines are limited to 72 useful char.s . A line of more than
|
||||
-- 72 char.s will be splited into several ones of 72 max each.
|
||||
|
||||
AddLines (me : mutable; lines : HSequenceOfHAsciiString from TColStd);
|
||||
---Purpose : Adds a list of lines for file comment
|
||||
-- Each of them must comply with demand of AddLine
|
||||
|
||||
NbLines (me) returns Integer;
|
||||
---Purpose : Returns the count of stored lines
|
||||
|
||||
Line (me; num : Integer) returns CString;
|
||||
---Purpose : Returns a stored line given its rank
|
||||
|
||||
Lines (me) returns HSequenceOfHAsciiString from TColStd;
|
||||
---Purpose : Returns the complete list of lines in once
|
||||
|
||||
Perform (me; ctx : in out ContextWrite;
|
||||
writer : in out IGESWriter);
|
||||
---Purpose : Sends the comment lines to the file (Start Section)
|
||||
|
||||
Label (me) returns AsciiString from TCollection;
|
||||
---Purpose : Returns specific Label, which is
|
||||
-- "Add <nn> Comment Lines (Start Section)"
|
||||
|
||||
fields
|
||||
|
||||
thelist : HSequenceOfHAsciiString from TColStd;
|
||||
|
||||
end AddFileComment;
|
53
src/IGESSelect/IGESSelect_AddFileComment.cxx
Executable file
53
src/IGESSelect/IGESSelect_AddFileComment.cxx
Executable file
@@ -0,0 +1,53 @@
|
||||
// Copyright: Matra-Datavision 1994
|
||||
// File: IGESSelect_AddFileComment.cxx
|
||||
// Created: Fri Aug 26 14:10:58 1994
|
||||
// Author: Christian CAILLET
|
||||
// <cky>
|
||||
|
||||
#include <IGESSelect_AddFileComment.ixx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
IGESSelect_AddFileComment::IGESSelect_AddFileComment ()
|
||||
{ thelist = new TColStd_HSequenceOfHAsciiString(); }
|
||||
|
||||
void IGESSelect_AddFileComment::Clear ()
|
||||
{ thelist->Clear(); }
|
||||
|
||||
|
||||
void IGESSelect_AddFileComment::AddLine (const Standard_CString line)
|
||||
{ thelist->Append (new TCollection_HAsciiString(line)); }
|
||||
|
||||
void IGESSelect_AddFileComment::AddLines
|
||||
(const Handle(TColStd_HSequenceOfHAsciiString)& lines)
|
||||
{ thelist->Append (lines); }
|
||||
|
||||
Standard_Integer IGESSelect_AddFileComment::NbLines () const
|
||||
{ return thelist->Length(); }
|
||||
|
||||
Standard_CString IGESSelect_AddFileComment::Line
|
||||
(const Standard_Integer num) const
|
||||
{ return thelist->Value(num)->ToCString(); }
|
||||
|
||||
Handle(TColStd_HSequenceOfHAsciiString) IGESSelect_AddFileComment::Lines
|
||||
() const
|
||||
{ return thelist; }
|
||||
|
||||
void IGESSelect_AddFileComment::Perform
|
||||
(IFSelect_ContextWrite& ,
|
||||
IGESData_IGESWriter& writer) const
|
||||
{
|
||||
Standard_Integer i, nb = NbLines();
|
||||
for (i = 1; i <= nb; i ++) {
|
||||
writer.SendStartLine (Line(i));
|
||||
}
|
||||
}
|
||||
|
||||
TCollection_AsciiString IGESSelect_AddFileComment::Label () const
|
||||
{
|
||||
Standard_Integer nb = NbLines();
|
||||
char labl[80];
|
||||
sprintf (labl, "Add %d Comment Lines (Start Section)",nb);
|
||||
return TCollection_AsciiString (labl);
|
||||
}
|
30
src/IGESSelect/IGESSelect_AddGroup.cdl
Executable file
30
src/IGESSelect/IGESSelect_AddGroup.cdl
Executable file
@@ -0,0 +1,30 @@
|
||||
-- File: IGESSelect_AddGroup.cdl
|
||||
-- Created: Thu Mar 2 18:03:54 1995
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@pronox>
|
||||
---Copyright: Matra Datavision 1995
|
||||
|
||||
|
||||
class AddGroup from IGESSelect inherits ModelModifier from IGESSelect
|
||||
|
||||
---Purpose : Adds a Group to contain the entities designated by the
|
||||
-- Selection. If no Selection is given, nothing is done
|
||||
|
||||
uses AsciiString from TCollection,
|
||||
IGESModel, CopyTool, ContextModif
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable AddGroup;
|
||||
---Purpose : Creates an AddGroup
|
||||
|
||||
Performing (me; ctx : in out ContextModif;
|
||||
target : mutable IGESModel;
|
||||
TC : in out CopyTool);
|
||||
---Purpose : Specific action : Adds a new group
|
||||
|
||||
Label (me) returns AsciiString from TCollection;
|
||||
---Purpose : Returns a text which is
|
||||
-- "Add Group"
|
||||
|
||||
end AddGroup;
|
47
src/IGESSelect/IGESSelect_AddGroup.cxx
Executable file
47
src/IGESSelect/IGESSelect_AddGroup.cxx
Executable file
@@ -0,0 +1,47 @@
|
||||
#include <IGESSelect_AddGroup.ixx>
|
||||
#include <Interface_Check.hxx>
|
||||
#include <Interface_EntityIterator.hxx>
|
||||
#include <IGESBasic_Group.hxx>
|
||||
#include <IGESData_HArray1OfIGESEntity.hxx>
|
||||
#include <IGESData_IGESEntity.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
|
||||
|
||||
|
||||
IGESSelect_AddGroup::IGESSelect_AddGroup ()
|
||||
: IGESSelect_ModelModifier (Standard_True) { }
|
||||
|
||||
void IGESSelect_AddGroup::Performing
|
||||
(IFSelect_ContextModif& ctx,
|
||||
const Handle(IGESData_IGESModel)& target,
|
||||
Interface_CopyTool& TC) const
|
||||
{
|
||||
if (ctx.IsForAll()) {
|
||||
ctx.CCheck(0)->AddFail ("Add Group : Selection required not defined");
|
||||
return;
|
||||
}
|
||||
Interface_EntityIterator list = ctx.SelectedResult();
|
||||
Standard_Integer i = 0 , nb = list.NbEntities();
|
||||
if (nb == 0) {
|
||||
ctx.CCheck(0)->AddWarning ("Add Group : No entity selected");
|
||||
return;
|
||||
}
|
||||
if (nb == 1) {
|
||||
ctx.CCheck(0)->AddWarning ("Add Group : ONE entity selected");
|
||||
return;
|
||||
}
|
||||
Handle(IGESData_HArray1OfIGESEntity) arr =
|
||||
new IGESData_HArray1OfIGESEntity(1,nb);
|
||||
for (ctx.Start(); ctx.More(); ctx.Next()) {
|
||||
DeclareAndCast(IGESData_IGESEntity,ent,ctx.ValueResult());
|
||||
i ++;
|
||||
arr->SetValue(i,ent);
|
||||
}
|
||||
Handle(IGESBasic_Group) gr = new IGESBasic_Group;
|
||||
gr->Init (arr);
|
||||
target->AddEntity(gr);
|
||||
}
|
||||
|
||||
|
||||
TCollection_AsciiString IGESSelect_AddGroup::Label () const
|
||||
{ return TCollection_AsciiString ("Add Group"); }
|
52
src/IGESSelect/IGESSelect_AutoCorrect.cdl
Executable file
52
src/IGESSelect/IGESSelect_AutoCorrect.cdl
Executable file
@@ -0,0 +1,52 @@
|
||||
-- File: IGESSelect_AutoCorrect.cdl
|
||||
-- Created: Wed Jun 1 16:18:06 1994
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@bravox>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
class AutoCorrect from IGESSelect inherits ModelModifier from IGESSelect
|
||||
|
||||
---Purpose : Does the absolutely effective corrections on IGES Entity.
|
||||
-- That is to say : regarding the norm in details, some values
|
||||
-- have mandatory values, or set of values with constraints.
|
||||
-- When such values/constraints are univoque, they can be forced.
|
||||
-- Also nullifies items of Directory Part, Associativities, and
|
||||
-- Properties, which are not (or not longer) in <target> Model.
|
||||
--
|
||||
-- Works by calling a BasicEditor from IGESData
|
||||
-- Works with the specific IGES Services : DirChecker which
|
||||
-- allows to correct data in "Directory Part" of Entities (such
|
||||
-- as required values for status, or references to be null), and
|
||||
-- the specific IGES service OwnCorrect, which is specialised for
|
||||
-- each type of entity.
|
||||
--
|
||||
-- Remark : this does not comprise the computation of use flag or
|
||||
-- subordinate status according references, which is made by
|
||||
-- the ModelModifier class ComputeStatus.
|
||||
--
|
||||
-- The Input Selection, when present, designates the entities to
|
||||
-- be corrected. If it is not present, all the entities of the
|
||||
-- model are corrected.
|
||||
|
||||
uses AsciiString from TCollection,
|
||||
CopyTool, IGESModel, ContextModif,
|
||||
GeneralLib, SpecificLib, IGESEntity
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable AutoCorrect;
|
||||
---Purpose : Creates an AutoCorrect.
|
||||
|
||||
Performing (me; ctx : in out ContextModif;
|
||||
target : mutable IGESModel;
|
||||
TC : in out CopyTool);
|
||||
---Purpose : Specific action : corrects entities when it is absolutely
|
||||
-- obvious, i.e. non equivoque (by DirChecker and specific
|
||||
-- service OwnCorrect) : works with a protocol.
|
||||
|
||||
Label (me) returns AsciiString from TCollection;
|
||||
---Purpose : Returns a text which is
|
||||
-- "Auto-correction of IGES Entities"
|
||||
|
||||
end AutoCorrect;
|
37
src/IGESSelect/IGESSelect_AutoCorrect.cxx
Executable file
37
src/IGESSelect/IGESSelect_AutoCorrect.cxx
Executable file
@@ -0,0 +1,37 @@
|
||||
#include <IGESSelect_AutoCorrect.ixx>
|
||||
#include <IGESData_Protocol.hxx>
|
||||
#include <IGESData_BasicEditor.hxx>
|
||||
#include <Interface_Check.hxx>
|
||||
|
||||
#include <Interface_Macros.hxx>
|
||||
|
||||
|
||||
|
||||
|
||||
IGESSelect_AutoCorrect::IGESSelect_AutoCorrect ()
|
||||
: IGESSelect_ModelModifier (Standard_False) { }
|
||||
|
||||
void IGESSelect_AutoCorrect::Performing
|
||||
(IFSelect_ContextModif& ctx,
|
||||
const Handle(IGESData_IGESModel)& target,
|
||||
Interface_CopyTool& ) const
|
||||
{
|
||||
DeclareAndCast(IGESData_Protocol,protocol,ctx.Protocol());
|
||||
if (protocol.IsNull()) {
|
||||
ctx.CCheck()->AddFail("IGES Auto Correct, not called with Protocol");
|
||||
return;
|
||||
}
|
||||
|
||||
IGESData_BasicEditor corrector (target,protocol);
|
||||
for (ctx.Start(); ctx.More(); ctx.Next()) {
|
||||
DeclareAndCast(IGESData_IGESEntity,ent,ctx.ValueResult());
|
||||
Standard_Boolean done = corrector.AutoCorrect (ent);
|
||||
if (done) ctx.Trace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TCollection_AsciiString IGESSelect_AutoCorrect::Label () const
|
||||
{
|
||||
return TCollection_AsciiString ("Auto-Correction of IGES Entities");
|
||||
}
|
78
src/IGESSelect/IGESSelect_ChangeLevelList.cdl
Executable file
78
src/IGESSelect/IGESSelect_ChangeLevelList.cdl
Executable file
@@ -0,0 +1,78 @@
|
||||
-- File: IGESSelect_ChangeLevelList.cdl
|
||||
-- Created: Thu Aug 25 15:44:24 1994
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@anion>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
class ChangeLevelList from IGESSelect inherits ModelModifier from IGESSelect
|
||||
|
||||
---Purpose : Changes Level List (in directory part) to a new single value
|
||||
-- Only entities attached to a LevelListEntity are considered
|
||||
-- If OldNumber is defined, only entities whose LevelList
|
||||
-- contains its Value are processed. Else all LevelLists are.
|
||||
--
|
||||
-- Remark : this concerns the Directory Part only. The Level List
|
||||
-- Entities themselves (their content) are not affected.
|
||||
--
|
||||
-- If NewNumber is defined (positive or zero), it gives the new
|
||||
-- value for Level Number. Else, the first value of the LevelList
|
||||
-- is set as new LevelNumber
|
||||
|
||||
uses AsciiString from TCollection,
|
||||
IGESModel, CopyTool, ContextModif, IntParam
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable ChangeLevelList;
|
||||
---Purpose : Creates a ChangeLevelList, not yet defined
|
||||
-- (see SetOldNumber and SetNewNumber)
|
||||
|
||||
HasOldNumber (me) returns Boolean;
|
||||
---Purpose : Returns True if OldNumber is defined : then, only entities
|
||||
-- which have a LevelList which contains the value are processed.
|
||||
-- Else, all entities attached to a LevelList are.
|
||||
|
||||
OldNumber (me) returns mutable IntParam;
|
||||
---Purpose : Returns the parameter for OldNumber. If not defined (Null
|
||||
-- Handle), it will be interpreted as "all level lists"
|
||||
|
||||
SetOldNumber (me : mutable; param : mutable IntParam);
|
||||
---Purpose : Sets a parameter for OldNumber
|
||||
|
||||
HasNewNumber (me) returns Boolean;
|
||||
---Purpose : Returns True if NewNumber is defined : then, it gives the new
|
||||
-- value for Level Number. Else, the first value of the LevelList
|
||||
-- is used as new Level Number.
|
||||
|
||||
NewNumber (me) returns mutable IntParam;
|
||||
---Purpose : Returns the parameter for NewNumber. If not defined (Null
|
||||
-- Handle), it will be interpreted as "new value 0"
|
||||
|
||||
SetNewNumber (me : mutable; param : mutable IntParam);
|
||||
---Purpose : Sets a parameter for NewNumber
|
||||
|
||||
|
||||
Performing (me; ctx : in out ContextModif;
|
||||
target : mutable IGESModel;
|
||||
TC : in out CopyTool);
|
||||
---Purpose : Specific action : considers selected target entities :
|
||||
-- If OldNumber is not defined, all entities attached to a
|
||||
-- Level List
|
||||
-- If OldNumber is defined (value not negative), entities with a
|
||||
-- Level List which contains this value
|
||||
-- Attaches all these entities to value given by NewNumber, or
|
||||
-- the first value of the Level List
|
||||
|
||||
Label (me) returns AsciiString from TCollection;
|
||||
---Purpose : Returns a text which begins by
|
||||
-- "Changes Level Lists containing <old>", or
|
||||
-- "Changes all Level Lists in D.E.", and ends by
|
||||
-- " to Number <new>" or " to Number = first value in List"
|
||||
|
||||
fields
|
||||
|
||||
theold : IntParam;
|
||||
thenew : IntParam;
|
||||
|
||||
end ChangeLevelList;
|
87
src/IGESSelect/IGESSelect_ChangeLevelList.cxx
Executable file
87
src/IGESSelect/IGESSelect_ChangeLevelList.cxx
Executable file
@@ -0,0 +1,87 @@
|
||||
// Copyright: Matra-Datavision 1994
|
||||
// File: IGESSelect_ChangeLevelList.cxx
|
||||
// Created: Thu Aug 25 15:53:24 1994
|
||||
// Author: Christian CAILLET
|
||||
// <cky>
|
||||
#include <IGESSelect_ChangeLevelList.ixx>
|
||||
#include <IGESData_LevelListEntity.hxx>
|
||||
#include <IGESData_IGESEntity.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
#include <stdio.h>
|
||||
#include <Interface_Check.hxx>
|
||||
|
||||
|
||||
IGESSelect_ChangeLevelList::IGESSelect_ChangeLevelList ()
|
||||
: IGESSelect_ModelModifier (Standard_True) { }
|
||||
|
||||
Standard_Boolean IGESSelect_ChangeLevelList::HasOldNumber () const
|
||||
{ return (!theold.IsNull()); }
|
||||
|
||||
Handle(IFSelect_IntParam) IGESSelect_ChangeLevelList::OldNumber () const
|
||||
{ return theold; }
|
||||
|
||||
void IGESSelect_ChangeLevelList::SetOldNumber
|
||||
(const Handle(IFSelect_IntParam)& param)
|
||||
{ theold = param; }
|
||||
|
||||
Standard_Boolean IGESSelect_ChangeLevelList::HasNewNumber () const
|
||||
{ return (!thenew.IsNull()); }
|
||||
|
||||
Handle(IFSelect_IntParam) IGESSelect_ChangeLevelList::NewNumber () const
|
||||
{ return thenew; }
|
||||
|
||||
void IGESSelect_ChangeLevelList::SetNewNumber
|
||||
(const Handle(IFSelect_IntParam)& param)
|
||||
{ thenew = param; }
|
||||
|
||||
|
||||
void IGESSelect_ChangeLevelList::Performing
|
||||
(IFSelect_ContextModif& ctx,
|
||||
const Handle(IGESData_IGESModel)& ,
|
||||
Interface_CopyTool& ) const
|
||||
{
|
||||
Standard_Integer oldl = 0;
|
||||
Standard_Boolean yaold = HasOldNumber();
|
||||
if (yaold) oldl = theold->Value();
|
||||
Standard_Boolean yanew = HasOldNumber();
|
||||
Standard_Integer newl = 0;
|
||||
if (yanew) newl = thenew->Value();
|
||||
if (oldl < 0) ctx.CCheck()->AddFail("ChangeLevelList : OldNumber negative");
|
||||
if (newl < 0) ctx.CCheck()->AddFail("ChangeLevelList : NewNumber negative");
|
||||
if (oldl < 0 || newl < 0) return;
|
||||
|
||||
Handle(IGESData_LevelListEntity) nulist;
|
||||
for (ctx.Start(); ctx.More(); ctx.Next()) {
|
||||
DeclareAndCast(IGESData_IGESEntity,ent,ctx.ValueResult());
|
||||
if (ent.IsNull()) continue;
|
||||
if (ent->DefLevel() != IGESData_DefSeveral) continue;
|
||||
if (yaold && ent->Level() != oldl) continue;
|
||||
if (!yanew) {
|
||||
Handle(IGESData_LevelListEntity) list = ent->LevelList();
|
||||
if (list.IsNull()) continue;
|
||||
newl = (list->NbLevelNumbers() > 0 ? list->LevelNumber(1) : 0);
|
||||
if (newl < 0) newl = 0;
|
||||
}
|
||||
ent->InitLevel(nulist,newl);
|
||||
ctx.Trace();
|
||||
}
|
||||
}
|
||||
|
||||
TCollection_AsciiString IGESSelect_ChangeLevelList::Label () const
|
||||
{
|
||||
char labl[100];
|
||||
Standard_Integer oldl = 0;
|
||||
Standard_Boolean yaold = HasOldNumber();
|
||||
if (yaold) oldl = theold->Value();
|
||||
Standard_Boolean yanew = HasOldNumber();
|
||||
Standard_Integer newl = 0;
|
||||
if (yanew) newl = thenew->Value();
|
||||
|
||||
if (yaold) sprintf(labl,"Changes Level Lists containing %d", oldl);
|
||||
else sprintf(labl,"Changes all Level Lists in D.E. %d", oldl);
|
||||
TCollection_AsciiString label(labl);
|
||||
if (yanew) sprintf(labl," to Number %d",newl);
|
||||
else sprintf(labl," to Number = first value in List");
|
||||
label.AssignCat(labl);
|
||||
return label;
|
||||
}
|
69
src/IGESSelect/IGESSelect_ChangeLevelNumber.cdl
Executable file
69
src/IGESSelect/IGESSelect_ChangeLevelNumber.cdl
Executable file
@@ -0,0 +1,69 @@
|
||||
-- File: IGESSelect_ChangeLevelNumber.cdl
|
||||
-- Created: Thu Aug 25 15:01:48 1994
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@anion>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
class ChangeLevelNumber from IGESSelect inherits ModelModifier from IGESSelect
|
||||
|
||||
---Purpose : Changes Level Number (as null or single) to a new single value
|
||||
-- Entities attached to a LevelListEntity are ignored
|
||||
-- Entities considered can be, either all Entities but those
|
||||
-- attached to a LevelListEntity, or Entities attached to a
|
||||
-- specific Level Number (0 for not defined).
|
||||
--
|
||||
-- Remark : this concerns the Directory Part only. The Level List
|
||||
-- Entities themselves (their content) are not affected.
|
||||
|
||||
uses AsciiString from TCollection,
|
||||
IGESModel, CopyTool, ContextModif, IntParam
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable ChangeLevelNumber;
|
||||
---Purpose : Creates a ChangeLevelNumber, not yet defined
|
||||
-- (see SetOldNumber and SetNewNumber)
|
||||
|
||||
HasOldNumber (me) returns Boolean;
|
||||
---Purpose : Returns True if OldNumber is defined : then, only entities
|
||||
-- attached to the value of OldNumber will be considered. Else,
|
||||
-- all entities but those attached to a Level List will be.
|
||||
|
||||
OldNumber (me) returns mutable IntParam;
|
||||
---Purpose : Returns the parameter for OldNumber. If not defined (Null
|
||||
-- Handle), it will be interpreted as "all level numbers"
|
||||
|
||||
SetOldNumber (me : mutable; param : mutable IntParam);
|
||||
---Purpose : Sets a parameter for OldNumber
|
||||
|
||||
NewNumber (me) returns mutable IntParam;
|
||||
---Purpose : Returns the parameter for NewNumber. If not defined (Null
|
||||
-- Handle), it will be interpreted as "new value 0"
|
||||
|
||||
SetNewNumber (me : mutable; param : mutable IntParam);
|
||||
---Purpose : Sets a parameter for NewNumber
|
||||
|
||||
|
||||
Performing (me; ctx : in out ContextModif;
|
||||
target : mutable IGESModel;
|
||||
TC : in out CopyTool);
|
||||
---Purpose : Specific action : considers selected target entities :
|
||||
-- If OldNumber is not defined, all entities but those attached
|
||||
-- to a Level List
|
||||
-- If OldNumber is defined (value not negative), entities with a
|
||||
-- defined Level Number (can be zero)
|
||||
-- Attaches all these entities to value given by NewNumber, or
|
||||
-- zero if not defined
|
||||
|
||||
Label (me) returns AsciiString from TCollection;
|
||||
---Purpose : Returns a text which is
|
||||
-- "Changes Level Number <old> to <new>" , or
|
||||
-- "Changes all Levels Numbers positive and zero to <new>"
|
||||
|
||||
fields
|
||||
|
||||
theold : IntParam;
|
||||
thenew : IntParam;
|
||||
|
||||
end ChangeLevelNumber;
|
73
src/IGESSelect/IGESSelect_ChangeLevelNumber.cxx
Executable file
73
src/IGESSelect/IGESSelect_ChangeLevelNumber.cxx
Executable file
@@ -0,0 +1,73 @@
|
||||
// Copyright: Matra-Datavision 1994
|
||||
// File: IGESSelect_ChangeLevelNumber.cxx
|
||||
// Created: Thu Aug 25 15:21:12 1994
|
||||
// Author: Christian CAILLET
|
||||
// <cky>
|
||||
#include <IGESSelect_ChangeLevelNumber.ixx>
|
||||
#include <IGESData_LevelListEntity.hxx>
|
||||
#include <IGESData_IGESEntity.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
#include <stdio.h>
|
||||
#include <Interface_Check.hxx>
|
||||
|
||||
|
||||
IGESSelect_ChangeLevelNumber::IGESSelect_ChangeLevelNumber ()
|
||||
: IGESSelect_ModelModifier (Standard_False) { }
|
||||
|
||||
Standard_Boolean IGESSelect_ChangeLevelNumber::HasOldNumber () const
|
||||
{ return (!theold.IsNull()); }
|
||||
|
||||
Handle(IFSelect_IntParam) IGESSelect_ChangeLevelNumber::OldNumber () const
|
||||
{ return theold; }
|
||||
|
||||
void IGESSelect_ChangeLevelNumber::SetOldNumber
|
||||
(const Handle(IFSelect_IntParam)& param)
|
||||
{ theold = param; }
|
||||
|
||||
Handle(IFSelect_IntParam) IGESSelect_ChangeLevelNumber::NewNumber () const
|
||||
{ return thenew; }
|
||||
|
||||
void IGESSelect_ChangeLevelNumber::SetNewNumber
|
||||
(const Handle(IFSelect_IntParam)& param)
|
||||
{ thenew = param; }
|
||||
|
||||
|
||||
void IGESSelect_ChangeLevelNumber::Performing
|
||||
(IFSelect_ContextModif& ctx,
|
||||
const Handle(IGESData_IGESModel)& ,
|
||||
Interface_CopyTool& ) const
|
||||
{
|
||||
Standard_Integer oldl = 0;
|
||||
Standard_Boolean yaold = HasOldNumber();
|
||||
if (yaold) oldl = theold->Value();
|
||||
Standard_Integer newl = 0;
|
||||
if (!thenew.IsNull()) newl = thenew->Value();
|
||||
if (oldl < 0) ctx.CCheck()->AddFail("ChangeLevelNumber : OldNumber negative");
|
||||
if (newl < 0) ctx.CCheck()->AddFail("ChangeLevelNumber : NewNumber negative");
|
||||
if (oldl < 0 || newl < 0) return;
|
||||
|
||||
Handle(IGESData_LevelListEntity) nulist;
|
||||
for (ctx.Start(); ctx.More(); ctx.Next()) {
|
||||
DeclareAndCast(IGESData_IGESEntity,ent,ctx.ValueResult());
|
||||
if (ent.IsNull()) continue;
|
||||
if (ent->DefLevel() == IGESData_DefSeveral) continue;
|
||||
if (yaold && ent->Level() != oldl) continue;
|
||||
ent->InitLevel(nulist,newl);
|
||||
ctx.Trace();
|
||||
}
|
||||
}
|
||||
|
||||
TCollection_AsciiString IGESSelect_ChangeLevelNumber::Label () const
|
||||
{
|
||||
char labl[100];
|
||||
Standard_Integer oldl = 0;
|
||||
Standard_Boolean yaold = HasOldNumber();
|
||||
if (yaold) oldl = theold->Value();
|
||||
Standard_Integer newl = 0;
|
||||
if (!thenew.IsNull()) newl = thenew->Value();
|
||||
|
||||
if (yaold) sprintf(labl,"Changes Level Number %d to %d",oldl,newl);
|
||||
else sprintf(labl,"Changes all Level Numbers positive and zero to %d",
|
||||
newl);
|
||||
return TCollection_AsciiString(labl);
|
||||
}
|
39
src/IGESSelect/IGESSelect_ComputeStatus.cdl
Executable file
39
src/IGESSelect/IGESSelect_ComputeStatus.cdl
Executable file
@@ -0,0 +1,39 @@
|
||||
-- File: IGESSelect_ComputeStatus.cdl
|
||||
-- Created: Wed Jun 1 16:18:06 1994
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@bravox>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
class ComputeStatus from IGESSelect inherits ModelModifier from IGESSelect
|
||||
|
||||
---Purpose : Computes Status of IGES Entities for a whole IGESModel.
|
||||
-- This concerns SubordinateStatus and UseFlag, which must have
|
||||
-- some definite values according the way they are referenced.
|
||||
-- (see definitions of Logical use, Physical use, etc...)
|
||||
--
|
||||
-- Works by calling a BasicEditor from IGESData. Works on the
|
||||
-- whole produced (target) model, because computation is global.
|
||||
|
||||
uses AsciiString from TCollection,
|
||||
IGESModel, CopyTool, ContextModif
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable ComputeStatus;
|
||||
---Purpose : Creates an ComputeStatus, which uses the system Date
|
||||
|
||||
|
||||
Performing (me; ctx : in out ContextModif;
|
||||
target : mutable IGESModel;
|
||||
TC : in out CopyTool);
|
||||
---Purpose : Specific action : it first evaluates the required values for
|
||||
-- Subordinate Status and Use Flag (in Directory Part of each
|
||||
-- IGES Entity). Then it corrects them, for the whole target.
|
||||
-- Works with a Protocol. Implementation uses BasicEditor
|
||||
|
||||
Label (me) returns AsciiString from TCollection;
|
||||
---Purpose : Returns a text which is
|
||||
-- "Compute Subordinate Status and Use Flag"
|
||||
|
||||
end ComputeStatus;
|
30
src/IGESSelect/IGESSelect_ComputeStatus.cxx
Executable file
30
src/IGESSelect/IGESSelect_ComputeStatus.cxx
Executable file
@@ -0,0 +1,30 @@
|
||||
#include <IGESSelect_ComputeStatus.ixx>
|
||||
#include <IGESData_Protocol.hxx>
|
||||
#include <IGESData_BasicEditor.hxx>
|
||||
#include <Interface_Check.hxx>
|
||||
|
||||
#include <Interface_Macros.hxx>
|
||||
|
||||
IGESSelect_ComputeStatus::IGESSelect_ComputeStatus ()
|
||||
: IGESSelect_ModelModifier (Standard_False) { }
|
||||
|
||||
void IGESSelect_ComputeStatus::Performing
|
||||
(IFSelect_ContextModif& ctx,
|
||||
const Handle(IGESData_IGESModel)& target,
|
||||
Interface_CopyTool& ) const
|
||||
{
|
||||
DeclareAndCast(IGESData_Protocol,protocol,ctx.Protocol());
|
||||
if (protocol.IsNull()) {
|
||||
ctx.CCheck()->AddFail("IGES Compute Status, Protocol incorrect");
|
||||
return;
|
||||
}
|
||||
|
||||
IGESData_BasicEditor corrector (target,protocol);
|
||||
corrector.ComputeStatus();
|
||||
}
|
||||
|
||||
|
||||
TCollection_AsciiString IGESSelect_ComputeStatus::Label () const
|
||||
{
|
||||
return TCollection_AsciiString ("Compute Status of IGES Entities (Directory Part)");
|
||||
}
|
74
src/IGESSelect/IGESSelect_CounterOfLevelNumber.cdl
Executable file
74
src/IGESSelect/IGESSelect_CounterOfLevelNumber.cdl
Executable file
@@ -0,0 +1,74 @@
|
||||
-- File: IGESSelect_CounterOfLevelNumber.cdl
|
||||
-- Created: Tue May 31 14:32:15 1994
|
||||
-- Author: Modelistation
|
||||
-- <model@bravox>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
class CounterOfLevelNumber from IGESSelect inherits SignCounter
|
||||
|
||||
---Purpose : This class gives information about Level Number. It counts
|
||||
-- entities according level number, considering also the
|
||||
-- multiple level (see the class LevelList) for which an entity
|
||||
-- is attached to each of the listed levels.
|
||||
--
|
||||
-- Data are available, as level number, or as their alphanumeric
|
||||
-- counterparts ("LEVEL nnnnnnn", " NO LEVEL", " LEVEL LIST")
|
||||
|
||||
uses Integer, Transient, MapOfTransient, HAsciiString from TCollection,
|
||||
HArray1OfInteger from TColStd, HSequenceOfInteger from TColStd,
|
||||
Messenger from Message,
|
||||
HSequenceOfTransient, InterfaceModel
|
||||
|
||||
is
|
||||
|
||||
Create (withmap : Boolean = Standard_True;
|
||||
withlist : Boolean = Standard_False)
|
||||
returns mutable CounterOfLevelNumber;
|
||||
---Purpose : Creates a CounterOfLevelNumber, clear, ready to work
|
||||
-- <withmap> and <withlist> are transmitted to SignCounter
|
||||
|
||||
Clear (me : mutable) is redefined;
|
||||
---Purpose : Resets already memorized informations : also numeric data
|
||||
|
||||
AddSign (me : mutable; ent : Transient; model : InterfaceModel)
|
||||
is redefined;
|
||||
---Purpose : Adds an entity by considering its lrvrl number(s)
|
||||
-- A level is added both in numeric and alphanumeric form,
|
||||
-- i.e. LevelList gives "LEVEL LIST", others (no level or
|
||||
-- positive level) displays level number on 7 digits (C : %7d)
|
||||
-- Remark : an entity attached to a Level List is added for
|
||||
-- " LEVEL LIST", and for each of its constituant levels
|
||||
|
||||
AddLevel (me : mutable; ent : Transient; level : Integer);
|
||||
---Purpose : The internal action to record a new level number, positive,
|
||||
-- null (no level) or negative (level list)
|
||||
|
||||
HighestLevel (me) returns Integer;
|
||||
---Purpose : Returns the highest value found for a level number
|
||||
|
||||
NbTimesLevel (me; level : Integer) returns Integer;
|
||||
---Purpose : Returns the number of times a level is used,
|
||||
-- 0 if it has not been recorded at all
|
||||
-- <level> = 0 counts entities attached to no level
|
||||
-- <level> < 0 counts entities attached to a LevelList
|
||||
|
||||
Levels (me) returns HSequenceOfInteger;
|
||||
---Purpose : Returns the ordered list of used positive Level numbers
|
||||
|
||||
Sign (me; ent : Transient; model : InterfaceModel) returns HAsciiString is redefined;
|
||||
---Purpose : Determines and returns the value of the signature for an
|
||||
-- entity as an HAsciiString. Redefined, gives the same result
|
||||
-- as AddSign, see this method ("LEVEL LIST" or "nnnnnnn")
|
||||
|
||||
PrintCount (me; S : Messenger from Message) is redefined;
|
||||
---Purpose : Prints the counts of items (not the list) then the Highest
|
||||
-- Level Number recorded
|
||||
|
||||
fields
|
||||
|
||||
thehigh : Integer;
|
||||
thenblists : Integer;
|
||||
thelevels : HArray1OfInteger;
|
||||
|
||||
end CounterOfLevelNumber;
|
124
src/IGESSelect/IGESSelect_CounterOfLevelNumber.cxx
Executable file
124
src/IGESSelect/IGESSelect_CounterOfLevelNumber.cxx
Executable file
@@ -0,0 +1,124 @@
|
||||
#include <IGESSelect_CounterOfLevelNumber.ixx>
|
||||
#include <IGESData_IGESEntity.hxx>
|
||||
#include <IGESGraph_DefinitionLevel.hxx>
|
||||
#include <Dico_DictionaryOfInteger.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <Message_Messenger.hxx>
|
||||
|
||||
IGESSelect_CounterOfLevelNumber::IGESSelect_CounterOfLevelNumber
|
||||
(const Standard_Boolean withmap, const Standard_Boolean withlist)
|
||||
: IFSelect_SignCounter (withmap,withlist)
|
||||
{ thehigh = thenblists = 0; SetName("IGES Level Number"); }
|
||||
|
||||
void IGESSelect_CounterOfLevelNumber::Clear ()
|
||||
{ IFSelect_SignCounter::Clear();
|
||||
thelevels.Nullify(); thehigh = thenblists = 0; }
|
||||
|
||||
|
||||
void IGESSelect_CounterOfLevelNumber::AddSign
|
||||
(const Handle(Standard_Transient)& ent,
|
||||
const Handle(Interface_InterfaceModel)& /*model*/)
|
||||
{
|
||||
DeclareAndCast(IGESData_IGESEntity,igesent,ent);
|
||||
if (igesent.IsNull()) return;
|
||||
DeclareAndCast(IGESGraph_DefinitionLevel,levelist,igesent->LevelList());
|
||||
Standard_Integer level = igesent->Level();
|
||||
if (levelist.IsNull() && level < 0) return;
|
||||
|
||||
// Enregistrer ce/ces niveau(x)
|
||||
if (levelist.IsNull()) AddLevel(ent,level);
|
||||
else {
|
||||
Standard_Integer nb = levelist->NbPropertyValues();
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) {
|
||||
level = levelist->LevelNumber(i);
|
||||
AddLevel(ent,level);
|
||||
}
|
||||
AddLevel(ent,-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void IGESSelect_CounterOfLevelNumber::AddLevel
|
||||
(const Handle(Standard_Transient)& ent, const Standard_Integer level)
|
||||
{
|
||||
if (level < 0) {
|
||||
thenblists ++;
|
||||
Add (ent,"LEVEL LIST");
|
||||
return;
|
||||
}
|
||||
if (thelevels.IsNull()) { thelevels =
|
||||
new TColStd_HArray1OfInteger ( 0, (level > 100 ? level : 100) );
|
||||
thelevels->Init(0); }
|
||||
Standard_Integer upper = thelevels->Upper();
|
||||
if (level > upper) {
|
||||
Handle(TColStd_HArray1OfInteger) levels =
|
||||
new TColStd_HArray1OfInteger (0,level + 100); levels->Init(0);
|
||||
for (Standard_Integer i = 1; i <= upper; i ++)
|
||||
levels->SetValue(i,thelevels->Value(i));
|
||||
thelevels = levels;
|
||||
}
|
||||
thelevels->SetValue (level,thelevels->Value(level)+1);
|
||||
if (level > thehigh) thehigh = level;
|
||||
|
||||
// if (level == 0) Add(ent," NO LEVEL");
|
||||
// else {
|
||||
char signature[30];
|
||||
sprintf (signature,"%7d",level);
|
||||
Add (ent,signature);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
Standard_Integer IGESSelect_CounterOfLevelNumber::HighestLevel () const
|
||||
{ return thehigh; }
|
||||
|
||||
Standard_Integer IGESSelect_CounterOfLevelNumber::NbTimesLevel
|
||||
(const Standard_Integer level) const
|
||||
{
|
||||
if (level < 0) return thenblists;
|
||||
if (level > thehigh) return 0;
|
||||
return thelevels->Value(level);
|
||||
}
|
||||
|
||||
|
||||
Handle(TColStd_HSequenceOfInteger) IGESSelect_CounterOfLevelNumber::Levels
|
||||
() const
|
||||
{
|
||||
Handle(TColStd_HSequenceOfInteger) list = new TColStd_HSequenceOfInteger ();
|
||||
for (Standard_Integer i = 1; i <= thehigh; i ++) {
|
||||
if (thelevels->Value(i) > 0) list->Append(i);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
Handle(TCollection_HAsciiString) IGESSelect_CounterOfLevelNumber::Sign
|
||||
(const Handle(Standard_Transient)& ent,
|
||||
const Handle(Interface_InterfaceModel)& /*model*/) const
|
||||
{
|
||||
Handle(TCollection_HAsciiString) res;
|
||||
// reprend les termes de AddSign pour la preparation (lecture du level) ...
|
||||
DeclareAndCast(IGESData_IGESEntity,igesent,ent);
|
||||
if (igesent.IsNull()) return res;
|
||||
DeclareAndCast(IGESGraph_DefinitionLevel,levelist,igesent->LevelList());
|
||||
Standard_Integer level = igesent->Level();
|
||||
if (levelist.IsNull() && level < 0) return res;
|
||||
|
||||
// puis ceux de AddLevel pour calculer la signature
|
||||
if (level < 0) return new TCollection_HAsciiString ("LEVEL LIST");
|
||||
char signature[30];
|
||||
sprintf (signature,"%7d",level);
|
||||
return new TCollection_HAsciiString (signature);
|
||||
}
|
||||
|
||||
|
||||
void IGESSelect_CounterOfLevelNumber::PrintCount
|
||||
(const Handle(Message_Messenger)& S) const
|
||||
{
|
||||
IFSelect_SignatureList::PrintCount(S);
|
||||
S<<" Highest value : " << thehigh << endl;
|
||||
if (thenblists > 0) S<<"REMARK for LEVEL LIST : Entities are counted in"
|
||||
<<" <LEVEL LIST>\n, and in each Level value of their list"<<endl;
|
||||
}
|
45
src/IGESSelect/IGESSelect_DispPerDrawing.cdl
Executable file
45
src/IGESSelect/IGESSelect_DispPerDrawing.cdl
Executable file
@@ -0,0 +1,45 @@
|
||||
-- File: IGESSelect_DispPerDrawing.cdl
|
||||
-- Created: Tue May 31 17:40:19 1994
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@bravox>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
class DispPerDrawing from IGESSelect inherits Dispatch
|
||||
|
||||
---Purpose : This type of dispatch defines sets of entities attached to
|
||||
-- distinct drawings. This information is taken from attached
|
||||
-- views which appear in the Directory Part. Also Drawing Frames
|
||||
-- are considered when Drawings are part of input list.
|
||||
--
|
||||
-- Remaining data concern entities not attached to a drawing.
|
||||
|
||||
uses AsciiString from TCollection, EntityIterator, Graph, SubPartsIterator,
|
||||
ViewSorter
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable DispPerDrawing;
|
||||
---Purpose : Creates a DispPerDrawing
|
||||
|
||||
Label (me) returns AsciiString from TCollection;
|
||||
---Purpose : Returns as Label, "One File per Drawing"
|
||||
|
||||
-- -- Evaluation -- --
|
||||
|
||||
Packets (me; G : Graph; packs : in out SubPartsIterator);
|
||||
---Purpose : Computes the list of produced Packets. Packets are computed
|
||||
-- by a ViewSorter (SortDrawings with also frames).
|
||||
|
||||
CanHaveRemainder (me) returns Boolean is redefined;
|
||||
---Purpose : Returns True, because of entities attached to no view.
|
||||
|
||||
Remainder (me; G : Graph) returns EntityIterator is redefined;
|
||||
---Purpose : Returns Remainder which is a set of Entities.
|
||||
-- It is supposed to be called once Packets has been called.
|
||||
|
||||
fields
|
||||
|
||||
thesorter : ViewSorter;
|
||||
|
||||
end DispPerDrawing;
|
53
src/IGESSelect/IGESSelect_DispPerDrawing.cxx
Executable file
53
src/IGESSelect/IGESSelect_DispPerDrawing.cxx
Executable file
@@ -0,0 +1,53 @@
|
||||
#include <IGESSelect_DispPerDrawing.ixx>
|
||||
#include <IFSelect_Selection.hxx>
|
||||
#include <IGESData_IGESModel.hxx>
|
||||
#include <IFSelect_PacketList.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
|
||||
|
||||
|
||||
IGESSelect_DispPerDrawing::IGESSelect_DispPerDrawing ()
|
||||
{ thesorter = new IGESSelect_ViewSorter; }
|
||||
|
||||
TCollection_AsciiString IGESSelect_DispPerDrawing::Label () const
|
||||
{
|
||||
return TCollection_AsciiString("One File per Drawing");
|
||||
}
|
||||
|
||||
|
||||
void IGESSelect_DispPerDrawing::Packets
|
||||
(const Interface_Graph& G, IFGraph_SubPartsIterator& packs) const
|
||||
{
|
||||
if (FinalSelection().IsNull()) return;
|
||||
Interface_EntityIterator list = FinalSelection()->UniqueResult(G);
|
||||
thesorter->SetModel (GetCasted(IGESData_IGESModel,G.Model()));
|
||||
thesorter->Clear();
|
||||
thesorter->AddList (list.Content());
|
||||
thesorter->SortDrawings(G);
|
||||
Handle(IFSelect_PacketList) sets = thesorter->Sets(Standard_True);
|
||||
|
||||
packs.SetLoad();
|
||||
Standard_Integer nb = sets->NbPackets();
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) {
|
||||
packs.AddPart();
|
||||
packs.GetFromIter (sets->Entities(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean IGESSelect_DispPerDrawing::CanHaveRemainder () const
|
||||
{ return Standard_True; }
|
||||
|
||||
Interface_EntityIterator IGESSelect_DispPerDrawing::Remainder
|
||||
(const Interface_Graph& G) const
|
||||
{
|
||||
if (thesorter->NbEntities() == 0) {
|
||||
Interface_EntityIterator list;
|
||||
if (FinalSelection().IsNull()) return list;
|
||||
list = FinalSelection()->UniqueResult(G);
|
||||
thesorter->Clear();
|
||||
thesorter->AddList (list.Content());
|
||||
thesorter->SortDrawings(G);
|
||||
}
|
||||
return thesorter->Sets(Standard_True)->Duplicated (0,Standard_False);
|
||||
}
|
46
src/IGESSelect/IGESSelect_DispPerSingleView.cdl
Executable file
46
src/IGESSelect/IGESSelect_DispPerSingleView.cdl
Executable file
@@ -0,0 +1,46 @@
|
||||
-- File: IGESSelect_DispPerSingleView.cdl
|
||||
-- Created: Tue May 31 17:07:18 1994
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@bravox>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
class DispPerSingleView from IGESSelect inherits Dispatch
|
||||
|
||||
---Purpose : This type of dispatch defines sets of entities attached to
|
||||
-- distinct single views. This information appears in the
|
||||
-- Directory Part. Drawings are taken into account too,
|
||||
-- because of their frames (proper lists of annotations)
|
||||
--
|
||||
-- Remaining data concern entities not attached to a single view.
|
||||
|
||||
|
||||
uses AsciiString from TCollection, EntityIterator, Graph, SubPartsIterator,
|
||||
ViewSorter
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable DispPerSingleView;
|
||||
---Purpose : Creates a DispPerSingleView
|
||||
|
||||
Label (me) returns AsciiString from TCollection;
|
||||
---Purpose : Returns as Label, "One File per single View or Drawing Frame"
|
||||
|
||||
-- -- Evaluation -- --
|
||||
|
||||
Packets (me; G : Graph; packs : in out SubPartsIterator);
|
||||
---Purpose : Computes the list of produced Packets. Packets are computed
|
||||
-- by a ViewSorter (SortSingleViews with also frames).
|
||||
|
||||
CanHaveRemainder (me) returns Boolean is redefined;
|
||||
---Purpose : Returns True, because of entities attached to no view.
|
||||
|
||||
Remainder (me; G : Graph) returns EntityIterator is redefined;
|
||||
---Purpose : Returns Remainder which is a set of Entities.
|
||||
-- It is supposed to be called once Packets has been called.
|
||||
|
||||
fields
|
||||
|
||||
thesorter : ViewSorter;
|
||||
|
||||
end DispPerSingleView;
|
52
src/IGESSelect/IGESSelect_DispPerSingleView.cxx
Executable file
52
src/IGESSelect/IGESSelect_DispPerSingleView.cxx
Executable file
@@ -0,0 +1,52 @@
|
||||
#include <IGESSelect_DispPerSingleView.ixx>
|
||||
#include <IFSelect_Selection.hxx>
|
||||
#include <IGESData_IGESModel.hxx>
|
||||
#include <IFSelect_PacketList.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
|
||||
|
||||
IGESSelect_DispPerSingleView::IGESSelect_DispPerSingleView ()
|
||||
{ thesorter = new IGESSelect_ViewSorter; }
|
||||
|
||||
TCollection_AsciiString IGESSelect_DispPerSingleView::Label () const
|
||||
{
|
||||
return TCollection_AsciiString("One File per single View or Drawing Frame");
|
||||
}
|
||||
|
||||
|
||||
void IGESSelect_DispPerSingleView::Packets
|
||||
(const Interface_Graph& G, IFGraph_SubPartsIterator& packs) const
|
||||
{
|
||||
if (FinalSelection().IsNull()) return;
|
||||
Interface_EntityIterator list = FinalSelection()->UniqueResult(G);
|
||||
thesorter->SetModel (GetCasted(IGESData_IGESModel,G.Model()));
|
||||
thesorter->Clear();
|
||||
thesorter->AddList (list.Content());
|
||||
thesorter->SortSingleViews(Standard_True);
|
||||
Handle(IFSelect_PacketList) sets = thesorter->Sets(Standard_True);
|
||||
|
||||
packs.SetLoad();
|
||||
Standard_Integer nb = sets->NbPackets();
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) {
|
||||
packs.AddPart();
|
||||
packs.GetFromIter (sets->Entities(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean IGESSelect_DispPerSingleView::CanHaveRemainder () const
|
||||
{ return Standard_True; }
|
||||
|
||||
Interface_EntityIterator IGESSelect_DispPerSingleView::Remainder
|
||||
(const Interface_Graph& G) const
|
||||
{
|
||||
if (thesorter->NbEntities() == 0) {
|
||||
Interface_EntityIterator list;
|
||||
if (FinalSelection().IsNull()) return list;
|
||||
list = FinalSelection()->UniqueResult(G);
|
||||
thesorter->Clear();
|
||||
thesorter->Add (list.Content());
|
||||
thesorter->SortSingleViews(Standard_True);
|
||||
}
|
||||
return thesorter->Sets(Standard_True)->Duplicated (0,Standard_False);
|
||||
}
|
31
src/IGESSelect/IGESSelect_Dumper.cdl
Executable file
31
src/IGESSelect/IGESSelect_Dumper.cdl
Executable file
@@ -0,0 +1,31 @@
|
||||
-- File: IGESSelect_Dumper.cdl
|
||||
-- Created: Fri Jun 3 09:43:20 1994
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@sdsun2>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
class Dumper from IGESSelect inherits SessionDumper
|
||||
|
||||
---Purpose : Dumper from IGESSelect takes into account, for SessionFile, the
|
||||
-- classes defined in the package IGESSelect : Selections,
|
||||
-- Dispatches, Modifiers
|
||||
|
||||
uses Transient, AsciiString from TCollection, SessionFile
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable Dumper;
|
||||
---Purpose : Creates a Dumper and puts it into the Library of Dumper
|
||||
|
||||
WriteOwn (me; file : in out SessionFile; item : Transient) returns Boolean;
|
||||
---Purpose : Write the Own Parameters of Types defined in package IGESSelect
|
||||
-- Returns True if <item> has been processed, False else
|
||||
|
||||
ReadOwn (me; file : in out SessionFile;
|
||||
type : AsciiString from TCollection; item : out mutable Transient)
|
||||
returns Boolean;
|
||||
---Purpose : Recognizes and Read Own Parameters for Types of package
|
||||
-- IGESSelect. Returns True if done and <item> created, False else
|
||||
|
||||
end Dumper;
|
267
src/IGESSelect/IGESSelect_Dumper.cxx
Executable file
267
src/IGESSelect/IGESSelect_Dumper.cxx
Executable file
@@ -0,0 +1,267 @@
|
||||
#include <IGESSelect_Dumper.ixx>
|
||||
|
||||
#include <IGESSelect_DispPerSingleView.hxx>
|
||||
#include <IGESSelect_DispPerDrawing.hxx>
|
||||
//#include <IGESSelect_SelectIGESTypeForm.hxx>
|
||||
#include <IGESSelect_SelectVisibleStatus.hxx>
|
||||
#include <IGESSelect_SelectLevelNumber.hxx>
|
||||
#include <IGESSelect_SelectName.hxx>
|
||||
#include <IGESSelect_SelectFromSingleView.hxx>
|
||||
#include <IGESSelect_SelectFromDrawing.hxx>
|
||||
#include <IGESSelect_SelectSingleViewFrom.hxx>
|
||||
#include <IGESSelect_SelectDrawingFrom.hxx>
|
||||
#include <IGESSelect_SelectBypassGroup.hxx>
|
||||
#include <IGESSelect_FloatFormat.hxx>
|
||||
#include <IGESSelect_UpdateCreationDate.hxx>
|
||||
#include <IGESSelect_UpdateLastChange.hxx>
|
||||
#include <IGESSelect_SetVersion5.hxx>
|
||||
#include <IGESSelect_SetGlobalParameter.hxx>
|
||||
#include <IGESSelect_AutoCorrect.hxx>
|
||||
#include <IGESSelect_ComputeStatus.hxx>
|
||||
#include <IGESSelect_RebuildDrawings.hxx>
|
||||
#include <IGESSelect_RebuildGroups.hxx>
|
||||
#include <IGESSelect_ChangeLevelList.hxx>
|
||||
#include <IGESSelect_ChangeLevelNumber.hxx>
|
||||
#include <IGESSelect_SplineToBSpline.hxx>
|
||||
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
#include <IFSelect_IntParam.hxx>
|
||||
|
||||
#include <Interface_Macros.hxx>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
|
||||
IGESSelect_Dumper::IGESSelect_Dumper () { }
|
||||
|
||||
|
||||
Standard_Boolean IGESSelect_Dumper::WriteOwn
|
||||
(IFSelect_SessionFile& file, const Handle(Standard_Transient)& item) const
|
||||
{
|
||||
if (item.IsNull()) return Standard_False;
|
||||
Handle(Standard_Type) type = item->DynamicType();
|
||||
if (type == STANDARD_TYPE(IGESSelect_DispPerSingleView)) return Standard_True;
|
||||
if (type == STANDARD_TYPE(IGESSelect_DispPerDrawing)) return Standard_True;
|
||||
/* if (type == STANDARD_TYPE(IGESSelect_SelectIGESTypeForm)) {
|
||||
DeclareAndCast(IGESSelect_SelectIGESTypeForm,sf,item);
|
||||
Standard_Boolean exact = sf->IsExact();
|
||||
TCollection_AsciiString text = sf->SignatureText(); // attention, 1-2 term
|
||||
if (exact) file.SendText("exact");
|
||||
else file.SendText("contains");
|
||||
file.SendText(text.ToCString());
|
||||
return Standard_True;
|
||||
} */
|
||||
if (type == STANDARD_TYPE(IGESSelect_SelectVisibleStatus)) return Standard_True;
|
||||
if (type == STANDARD_TYPE(IGESSelect_SelectLevelNumber)) {
|
||||
DeclareAndCast(IGESSelect_SelectLevelNumber,sl,item);
|
||||
Handle(IFSelect_IntParam) lev = sl->LevelNumber();
|
||||
file.SendItem(lev);
|
||||
return Standard_True;
|
||||
}
|
||||
if (type == STANDARD_TYPE(IGESSelect_SelectName)) {
|
||||
DeclareAndCast(IGESSelect_SelectName,sn,item);
|
||||
Handle(TCollection_HAsciiString) name = sn->Name();
|
||||
file.SendItem(name);
|
||||
return Standard_True;
|
||||
}
|
||||
if (type == STANDARD_TYPE(IGESSelect_SelectFromSingleView)) return Standard_True;
|
||||
if (type == STANDARD_TYPE(IGESSelect_SelectFromDrawing)) return Standard_True;
|
||||
if (type == STANDARD_TYPE(IGESSelect_SelectSingleViewFrom)) return Standard_True;
|
||||
if (type == STANDARD_TYPE(IGESSelect_SelectDrawingFrom)) return Standard_True;
|
||||
if (type == STANDARD_TYPE(IGESSelect_SelectBypassGroup)) return Standard_True;
|
||||
|
||||
if (type == STANDARD_TYPE(IGESSelect_FloatFormat)) {
|
||||
DeclareAndCast(IGESSelect_FloatFormat,ff,item);
|
||||
Standard_Boolean zerosup, hasrange;
|
||||
Standard_Real rangemin, rangemax;
|
||||
TCollection_AsciiString mainform,forminrange;
|
||||
ff->Format (zerosup,mainform,hasrange,forminrange,rangemin,rangemax);
|
||||
file.SendText((char*)(zerosup ? "zerosup" : "nozerosup"));
|
||||
file.SendText(mainform.ToCString());
|
||||
if (hasrange) {
|
||||
char flotrange[20];
|
||||
file.SendText(forminrange.ToCString());
|
||||
sprintf(flotrange,"%f",rangemin);
|
||||
file.SendText(flotrange);
|
||||
sprintf(flotrange,"%f",rangemax);
|
||||
file.SendText(flotrange);
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
if (type == STANDARD_TYPE(IGESSelect_UpdateCreationDate)) return Standard_True;
|
||||
if (type == STANDARD_TYPE(IGESSelect_UpdateLastChange)) return Standard_True;
|
||||
if (type == STANDARD_TYPE(IGESSelect_SetVersion5)) return Standard_True;
|
||||
if (type == STANDARD_TYPE(IGESSelect_SetGlobalParameter)) {
|
||||
DeclareAndCast(IGESSelect_SetGlobalParameter,sp,item);
|
||||
Standard_Integer np = sp->GlobalNumber();
|
||||
Handle(TCollection_HAsciiString) val = sp->Value();
|
||||
char intext[10];
|
||||
sprintf(intext,"%d",np);
|
||||
file.SendText(intext);
|
||||
file.SendItem(val);
|
||||
return Standard_True;
|
||||
}
|
||||
if (type == STANDARD_TYPE(IGESSelect_AutoCorrect)) return Standard_True;
|
||||
if (type == STANDARD_TYPE(IGESSelect_ComputeStatus)) return Standard_True;
|
||||
if (type == STANDARD_TYPE(IGESSelect_RebuildDrawings)) return Standard_True;
|
||||
if (type == STANDARD_TYPE(IGESSelect_RebuildGroups)) return Standard_True;
|
||||
if (type == STANDARD_TYPE(IGESSelect_ChangeLevelList)) {
|
||||
DeclareAndCast(IGESSelect_ChangeLevelList,cl,item);
|
||||
file.SendItem(cl->OldNumber());
|
||||
file.SendItem(cl->NewNumber());
|
||||
return Standard_True;
|
||||
}
|
||||
if (type == STANDARD_TYPE(IGESSelect_ChangeLevelNumber)) {
|
||||
DeclareAndCast(IGESSelect_ChangeLevelNumber,cl,item);
|
||||
file.SendItem(cl->OldNumber());
|
||||
file.SendItem(cl->NewNumber());
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
if (type == STANDARD_TYPE(IGESSelect_SplineToBSpline)) {
|
||||
Standard_Boolean tryc2 =
|
||||
GetCasted(IGESSelect_SplineToBSpline,item)->OptionTryC2();
|
||||
file.SendText((char*)(tryc2 ? "TryC2" : "Normal"));
|
||||
return Standard_True;
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean IGESSelect_Dumper::ReadOwn
|
||||
(IFSelect_SessionFile& file, const TCollection_AsciiString& type,
|
||||
Handle(Standard_Transient)& item) const
|
||||
{
|
||||
if (type.IsEqual("IGESSelect_DispPerSingleView"))
|
||||
{ item = new IGESSelect_DispPerSingleView; return Standard_True; }
|
||||
if (type.IsEqual("IGESSelect_DispPerDrawing"))
|
||||
{ item = new IGESSelect_DispPerDrawing; return Standard_True; }
|
||||
|
||||
if (type.IsEqual("IGESSelect_SelectIGESTypeForm")) {
|
||||
if (file.NbParams() < 2) return Standard_False;
|
||||
//Standard_Boolean exact; //szv#4:S4163:12Mar99 not needed
|
||||
const TCollection_AsciiString exname = file.ParamValue(1);
|
||||
if (exname.Length() < 1) return Standard_False;
|
||||
if (exname.Value(1) == 'e') {} //szv#4:S4163:12Mar99 `exact = Standard_True` not needed
|
||||
else if (exname.Value(1) == 'c') {} //szv#4:S4163:12Mar99 `exact = Standard_False` not needed
|
||||
else return Standard_False;
|
||||
// Attention, 2 termes possibles pour la signature
|
||||
char sig[40];
|
||||
if (file.NbParams() == 2) sprintf(sig,"%s",file.ParamValue(2).ToCString());
|
||||
else sprintf(sig,"%s %s",file.ParamValue(2).ToCString(),file.ParamValue(3).ToCString());
|
||||
// item = new IGESSelect_SelectIGESTypeForm(sig,exact);
|
||||
// return Standard_True;
|
||||
}
|
||||
if (type.IsEqual("IGESSelect_SelectVisibleStatus"))
|
||||
{ item = new IGESSelect_SelectVisibleStatus; return Standard_True; }
|
||||
|
||||
if (type.IsEqual("IGESSelect_SelectLevelNumber")) {
|
||||
if (file.NbParams() < 1) return Standard_False;
|
||||
Handle(IGESSelect_SelectLevelNumber) sl = new IGESSelect_SelectLevelNumber;
|
||||
DeclareAndCast(IFSelect_IntParam,lev,file.ItemValue(1));
|
||||
sl->SetLevelNumber(lev);
|
||||
item = sl;
|
||||
return Standard_True;
|
||||
}
|
||||
if (type.IsEqual("IGESSelect_SelectName")) {
|
||||
if (file.NbParams() < 1) return Standard_False;
|
||||
Handle(IGESSelect_SelectName) sn = new IGESSelect_SelectName;
|
||||
Handle(TCollection_HAsciiString) name = sn->Name();
|
||||
item = sn;
|
||||
return Standard_True;
|
||||
}
|
||||
if (type.IsEqual("IGESSelect_SelectFromSingleView"))
|
||||
{ item = new IGESSelect_SelectFromSingleView; return Standard_True; }
|
||||
if (type.IsEqual("IGESSelect_SelectFromDrawing"))
|
||||
{ item = new IGESSelect_SelectFromDrawing; return Standard_True; }
|
||||
if (type.IsEqual("IGESSelect_SelectSingleViewFrom"))
|
||||
{ item = new IGESSelect_SelectSingleViewFrom; return Standard_True; }
|
||||
if (type.IsEqual("IGESSelect_SelectDrawingFrom"))
|
||||
{ item = new IGESSelect_SelectDrawingFrom; return Standard_True; }
|
||||
if (type.IsEqual("IGESSelect_SelectBypassGroup"))
|
||||
{ item = new IGESSelect_SelectBypassGroup; return Standard_True; }
|
||||
|
||||
if (type.IsEqual("IGESSelect_FloatFormat")) {
|
||||
if (file.NbParams() < 2) return Standard_False;
|
||||
Handle(IGESSelect_FloatFormat) ff = new IGESSelect_FloatFormat;
|
||||
Standard_Boolean zerosup;
|
||||
const TCollection_AsciiString zsup = file.ParamValue(1);
|
||||
if (zsup.Length() < 1) return Standard_False;
|
||||
if (zsup.Value(1) == 'z') zerosup = Standard_True;
|
||||
else if (zsup.Value(1) == 'n') zerosup = Standard_False;
|
||||
else return Standard_False;
|
||||
ff->SetFormat(file.ParamValue(2).ToCString());
|
||||
ff->SetZeroSuppress(zerosup);
|
||||
if (file.NbParams() >= 5) {
|
||||
//char flotrange[20]; //szv#4:S4163:12Mar99 unused
|
||||
Standard_Real rangemin, rangemax;
|
||||
rangemin = atof (file.ParamValue(4).ToCString());
|
||||
rangemax = atof (file.ParamValue(5).ToCString());
|
||||
ff->SetFormatForRange (file.ParamValue(3).ToCString(),rangemin,rangemax);
|
||||
}
|
||||
item = ff;
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
if (type.IsEqual("IGESSelect_UpdateCreationDate"))
|
||||
{ item = new IGESSelect_UpdateCreationDate; return Standard_True; }
|
||||
if (type.IsEqual("IGESSelect_UpdateLastChange"))
|
||||
{ item = new IGESSelect_UpdateLastChange; return Standard_True; }
|
||||
if (type.IsEqual("IGESSelect_SetVersion5"))
|
||||
{ item = new IGESSelect_SetVersion5; return Standard_True; }
|
||||
if (type.IsEqual("IGESSelect_SetGlobalParameter")) {
|
||||
if (file.NbParams() < 2) return Standard_False;
|
||||
Standard_Integer np = atoi(file.ParamValue(1).ToCString());
|
||||
DeclareAndCast(TCollection_HAsciiString,val,file.ItemValue(2));
|
||||
Handle(IGESSelect_SetGlobalParameter) sp =
|
||||
new IGESSelect_SetGlobalParameter(np);
|
||||
sp->SetValue(val);
|
||||
item = sp;
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
if (type.IsEqual("IGESSelect_AutoCorrect"))
|
||||
{ item = new IGESSelect_AutoCorrect; return Standard_True; }
|
||||
if (type.IsEqual("IGESSelect_ComputeStatus"))
|
||||
{ item = new IGESSelect_ComputeStatus; return Standard_True; }
|
||||
if (type.IsEqual("IGESSelect_RebuildDrawings"))
|
||||
{ item = new IGESSelect_RebuildDrawings; return Standard_True; }
|
||||
if (type.IsEqual("IGESSelect_RebuildGroups"))
|
||||
{ item = new IGESSelect_RebuildGroups; return Standard_True; }
|
||||
|
||||
if (type.IsEqual("IGESSelect_ChangeLevelList")) {
|
||||
if (file.NbParams() < 2) return Standard_False;
|
||||
Handle(IGESSelect_ChangeLevelList) cl = new IGESSelect_ChangeLevelList;
|
||||
DeclareAndCast(IFSelect_IntParam,oldpar,file.ItemValue(1));
|
||||
DeclareAndCast(IFSelect_IntParam,newpar,file.ItemValue(2));
|
||||
cl->SetOldNumber(oldpar);
|
||||
cl->SetNewNumber(newpar);
|
||||
item = cl;
|
||||
return Standard_True;
|
||||
}
|
||||
if (type.IsEqual("IGESSelect_ChangeLevelNumber")) {
|
||||
if (file.NbParams() < 2) return Standard_False;
|
||||
Handle(IGESSelect_ChangeLevelNumber) cl = new IGESSelect_ChangeLevelNumber;
|
||||
DeclareAndCast(IFSelect_IntParam,oldpar,file.ItemValue(1));
|
||||
DeclareAndCast(IFSelect_IntParam,newpar,file.ItemValue(2));
|
||||
cl->SetOldNumber(oldpar);
|
||||
cl->SetNewNumber(newpar);
|
||||
item = cl;
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
if (type.IsEqual("IGESSelect_SplineToBSpline")) {
|
||||
if (file.NbParams() < 1) return Standard_False;
|
||||
Standard_Boolean tryc2;
|
||||
const TCollection_AsciiString tc2 = file.ParamValue(1);
|
||||
if (tc2.Length() < 1) return Standard_False;
|
||||
if (tc2.Value(1) == 'T') tryc2 = Standard_True;
|
||||
else if (tc2.Value(1) == 'N') tryc2 = Standard_False;
|
||||
else return Standard_False;
|
||||
item = new IGESSelect_SplineToBSpline(tryc2);
|
||||
return Standard_True;
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
37
src/IGESSelect/IGESSelect_EditDirPart.cdl
Executable file
37
src/IGESSelect/IGESSelect_EditDirPart.cdl
Executable file
@@ -0,0 +1,37 @@
|
||||
-- File: IGESSelect_EditDirPart.cdl
|
||||
-- Created: Mon Sep 7 15:52:55 1998
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@heliox.paris1.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 1998
|
||||
|
||||
|
||||
class EditDirPart from IGESSelect inherits Editor from IFSelect
|
||||
|
||||
---Purpose : This class is aimed to display and edit the Directory Part of
|
||||
-- an IGESEntity
|
||||
|
||||
uses Transient, AsciiString, HAsciiString, InterfaceModel, EditForm
|
||||
|
||||
is
|
||||
|
||||
Create returns EditDirPart;
|
||||
|
||||
Label (me) returns AsciiString;
|
||||
|
||||
Recognize (me; form : EditForm) returns Boolean;
|
||||
|
||||
StringValue (me; form : EditForm; num : Integer)
|
||||
returns HAsciiString from TCollection;
|
||||
|
||||
Load (me; form : EditForm; ent : Transient; model : InterfaceModel)
|
||||
returns Boolean;
|
||||
|
||||
Update (me; form : mutable EditForm; num : Integer;
|
||||
newval : HAsciiString; enforce : Boolean)
|
||||
returns Boolean is redefined;
|
||||
-- for dynamically computed values
|
||||
|
||||
Apply (me; form : EditForm; ent : Transient; model : InterfaceModel)
|
||||
returns Boolean;
|
||||
|
||||
end EditDirPart;
|
401
src/IGESSelect/IGESSelect_EditDirPart.cxx
Executable file
401
src/IGESSelect/IGESSelect_EditDirPart.cxx
Executable file
@@ -0,0 +1,401 @@
|
||||
#include <IGESSelect_EditDirPart.ixx>
|
||||
#include <Interface_TypedValue.hxx>
|
||||
#include <Interface_Static.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
|
||||
#include <IGESData_IGESModel.hxx>
|
||||
|
||||
#include <IGESData_IGESEntity.hxx>
|
||||
#include <IGESData_LineFontEntity.hxx>
|
||||
#include <IGESData_LevelListEntity.hxx>
|
||||
#include <IGESData_ViewKindEntity.hxx>
|
||||
#include <IGESData_TransfEntity.hxx>
|
||||
#include <IGESData_LabelDisplayEntity.hxx>
|
||||
#include <IGESData_ColorEntity.hxx>
|
||||
|
||||
|
||||
|
||||
|
||||
static Handle(Interface_TypedValue) NewDefType(const Standard_CString name)
|
||||
{
|
||||
Handle(Interface_TypedValue) deftype = new Interface_TypedValue(name,Interface_ParamEnum);
|
||||
deftype->StartEnum(0);
|
||||
deftype->AddEnumValue("Void",0);
|
||||
deftype->AddEnumValue("Value",1);
|
||||
deftype->AddEnumValue("Entity",2);
|
||||
return deftype;
|
||||
}
|
||||
|
||||
static Handle(Interface_TypedValue) NewDefList(const Standard_CString name)
|
||||
{
|
||||
Handle(Interface_TypedValue) deftype = new Interface_TypedValue(name,Interface_ParamEnum);
|
||||
deftype->StartEnum(0);
|
||||
deftype->AddEnumValue("None",0);
|
||||
deftype->AddEnumValue("One",1);
|
||||
deftype->AddEnumValue("List",2);
|
||||
return deftype;
|
||||
}
|
||||
|
||||
IGESSelect_EditDirPart::IGESSelect_EditDirPart ()
|
||||
: IFSelect_Editor (23)
|
||||
{
|
||||
//Standard_Integer i,nb; //szv#4:S4163:12Mar99 unused
|
||||
// Definition
|
||||
Handle(Interface_TypedValue) typenum = new Interface_TypedValue("Type Number",Interface_ParamInteger);
|
||||
SetValue (1,typenum,"D1:Type",IFSelect_EditRead);
|
||||
Handle(Interface_TypedValue) formnum = new Interface_TypedValue("Form Number",Interface_ParamInteger);
|
||||
SetValue (2,formnum,"D15:Form",IFSelect_EditRead);
|
||||
|
||||
Handle(Interface_TypedValue) stru = new Interface_TypedValue("Structure",Interface_ParamIdent);
|
||||
SetValue (3,stru,"D3:Struct",IFSelect_Optional);
|
||||
|
||||
Handle(Interface_TypedValue) lftype = NewDefType("Line Font Pattern");
|
||||
SetValue (4,lftype,"D4:LineFont",IFSelect_EditDynamic);
|
||||
Handle(Interface_TypedValue) lfval = new Interface_TypedValue("Line Font Number",Interface_ParamInteger);
|
||||
lfval->SetIntegerLimit (Standard_False,0);
|
||||
SetValue (5,lfval, "N4:LineFont",IFSelect_Optional);
|
||||
Handle(Interface_TypedValue) lfent = new Interface_TypedValue("Line Font Entity",Interface_ParamIdent);
|
||||
SetValue (6,lfent, "E4:LineFont",IFSelect_Optional);
|
||||
|
||||
Handle(Interface_TypedValue) levlist = NewDefList("Level");
|
||||
SetValue (7,levlist,"D5:Level",IFSelect_EditDynamic);
|
||||
Handle(Interface_TypedValue) leval = new Interface_TypedValue("Level Number",Interface_ParamInteger);
|
||||
leval->SetIntegerLimit (Standard_False,0);
|
||||
SetValue (8,leval,"N5:Level",IFSelect_Optional);
|
||||
Handle(Interface_TypedValue) levent = new Interface_TypedValue("Level List Entity",Interface_ParamIdent);
|
||||
SetValue (9,levent,"L5:Level",IFSelect_Optional);
|
||||
|
||||
Handle(Interface_TypedValue) viewlist = NewDefList("View");
|
||||
SetValue (10,viewlist,"D6:View",IFSelect_EditDynamic);
|
||||
Handle(Interface_TypedValue) viewent = new Interface_TypedValue("View Entity",Interface_ParamIdent);
|
||||
SetValue (11,viewent,"E6:View",IFSelect_Optional);
|
||||
|
||||
Handle(Interface_TypedValue) transf = new Interface_TypedValue("Transformation",Interface_ParamIdent);
|
||||
SetValue (12,transf,"D7:Transf",IFSelect_Optional);
|
||||
|
||||
Handle(Interface_TypedValue) labdisp = new Interface_TypedValue("Label Display Associativity",Interface_ParamIdent);
|
||||
SetValue (13,labdisp,"D8:LabelDisp",IFSelect_Optional);
|
||||
|
||||
Handle(Interface_TypedValue) blank = new Interface_TypedValue("Blank Status",Interface_ParamInteger);
|
||||
blank->SetIntegerLimit (Standard_False,0);
|
||||
blank->SetIntegerLimit (Standard_True ,1);
|
||||
SetValue (14,blank,"D9-1:Blank");
|
||||
Handle(Interface_TypedValue) subord = new Interface_TypedValue("Subordinate Status",Interface_ParamInteger);
|
||||
subord->SetIntegerLimit (Standard_False,0);
|
||||
subord->SetIntegerLimit (Standard_True ,3);
|
||||
SetValue (15,subord,"D9-2:Subordinate",IFSelect_EditProtected);
|
||||
Handle(Interface_TypedValue) useflg = new Interface_TypedValue("Use Flag",Interface_ParamInteger);
|
||||
useflg->SetIntegerLimit (Standard_False,0);
|
||||
useflg->SetIntegerLimit (Standard_True ,6);
|
||||
SetValue (16,useflg,"D9-3:UseFlag");
|
||||
Handle(Interface_TypedValue) hier = new Interface_TypedValue("Hierarchy",Interface_ParamInteger);
|
||||
hier->SetIntegerLimit (Standard_False,0);
|
||||
hier->SetIntegerLimit (Standard_True ,2);
|
||||
SetValue (17,hier,"D9-4:Hierarchy",IFSelect_EditProtected);
|
||||
|
||||
Handle(Interface_TypedValue) lwnum = new Interface_TypedValue("Line Weight Number",Interface_ParamInteger);
|
||||
lwnum->SetIntegerLimit (Standard_False,0);
|
||||
SetValue (18,lwnum,"D12:LineWeight");
|
||||
|
||||
Handle(Interface_TypedValue) coltype = NewDefType("Color");
|
||||
SetValue (19,coltype,"D13:Color",IFSelect_EditDynamic);
|
||||
Handle(Interface_TypedValue) colval = new Interface_TypedValue("Color Number",Interface_ParamInteger);
|
||||
colval->SetIntegerLimit (Standard_False,0);
|
||||
SetValue (20,colval, "N13:Color",IFSelect_Optional);
|
||||
Handle(Interface_TypedValue) colent = new Interface_TypedValue("Color Entity",Interface_ParamIdent);
|
||||
SetValue (21,colent, "E13:Color",IFSelect_Optional);
|
||||
|
||||
Handle(Interface_TypedValue) entlab = new Interface_TypedValue("Entity Label");
|
||||
SetValue (22,entlab,"D18:Label");
|
||||
Handle(Interface_TypedValue) sublab = new Interface_TypedValue("Subscript Number",Interface_ParamInteger);
|
||||
SetValue (23,sublab,"D19:Subscript",IFSelect_Optional);
|
||||
|
||||
}
|
||||
|
||||
TCollection_AsciiString IGESSelect_EditDirPart::Label () const
|
||||
{ return TCollection_AsciiString ("IGES Header"); }
|
||||
|
||||
Standard_Boolean IGESSelect_EditDirPart::Recognize
|
||||
(const Handle(IFSelect_EditForm)& form) const
|
||||
{ return Standard_True; } // ??
|
||||
|
||||
Handle(TCollection_HAsciiString) IGESSelect_EditDirPart::StringValue
|
||||
(const Handle(IFSelect_EditForm)& form, const Standard_Integer num) const
|
||||
{
|
||||
// Default Values
|
||||
return TypedValue(num)->HStringValue();
|
||||
}
|
||||
|
||||
|
||||
Handle(TCollection_HAsciiString) DefTypeName (const IGESData_DefType& deftype)
|
||||
{
|
||||
switch (deftype) {
|
||||
case IGESData_DefVoid : return new TCollection_HAsciiString("Void");
|
||||
case IGESData_DefValue : return new TCollection_HAsciiString("Value");
|
||||
case IGESData_DefReference : return new TCollection_HAsciiString("Entity");
|
||||
default : break;
|
||||
}
|
||||
return new TCollection_HAsciiString("???");
|
||||
}
|
||||
|
||||
Handle(TCollection_HAsciiString) DefListName (const IGESData_DefList& deflist)
|
||||
{
|
||||
switch (deflist) {
|
||||
case IGESData_DefNone : return new TCollection_HAsciiString("None");
|
||||
case IGESData_DefOne : return new TCollection_HAsciiString("One");
|
||||
case IGESData_DefSeveral : return new TCollection_HAsciiString("List");
|
||||
default : break;
|
||||
}
|
||||
return new TCollection_HAsciiString("???");
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean IGESSelect_EditDirPart::Load
|
||||
(const Handle(IFSelect_EditForm)& form,
|
||||
const Handle(Standard_Transient)& ent,
|
||||
const Handle(Interface_InterfaceModel)& model) const
|
||||
{
|
||||
Handle(IGESData_IGESModel) modl =
|
||||
Handle(IGESData_IGESModel)::DownCast(model);
|
||||
if (modl.IsNull()) return Standard_False;
|
||||
Handle(IGESData_IGESEntity) iges =
|
||||
Handle(IGESData_IGESEntity)::DownCast(ent);
|
||||
if (iges.IsNull()) return Standard_False;
|
||||
|
||||
form->LoadValue (1 ,new TCollection_HAsciiString(iges->TypeNumber()));
|
||||
form->LoadValue (2 ,new TCollection_HAsciiString(iges->FormNumber()));
|
||||
if (iges->HasStructure()) form->LoadValue (3 ,modl->StringLabel(iges->Structure()) );
|
||||
|
||||
form->LoadValue (4 ,DefTypeName (iges->DefLineFont()) );
|
||||
form->LoadValue (5 ,new TCollection_HAsciiString(iges->RankLineFont()) );
|
||||
if (iges->DefLineFont() == IGESData_DefReference)
|
||||
form->LoadValue (6 ,modl->StringLabel(iges->LineFont()) );
|
||||
|
||||
form->LoadValue (7 ,DefListName (iges->DefLevel()) );
|
||||
form->LoadValue (8 ,new TCollection_HAsciiString (iges->Level()) );
|
||||
if (iges->DefLevel() == IGESData_DefSeveral)
|
||||
form->LoadValue (9 ,modl->StringLabel(iges->LevelList()) );
|
||||
|
||||
form->LoadValue (10 ,DefListName (iges->DefView()) );
|
||||
if (iges->DefView() != IGESData_DefNone)
|
||||
form->LoadValue (11 ,modl->StringLabel(iges->View()) );
|
||||
|
||||
if (iges->HasTransf()) form->LoadValue (12 ,modl->StringLabel(iges->Transf()) );
|
||||
if (iges->HasLabelDisplay()) form->LoadValue (13 ,modl->StringLabel(iges->LabelDisplay()) );
|
||||
|
||||
form->LoadValue (14 ,new TCollection_HAsciiString(iges->BlankStatus()) );
|
||||
form->LoadValue (15 ,new TCollection_HAsciiString(iges->SubordinateStatus()) );
|
||||
form->LoadValue (16 ,new TCollection_HAsciiString(iges->UseFlag()) );
|
||||
form->LoadValue (17 ,new TCollection_HAsciiString(iges->HierarchyStatus()) );
|
||||
|
||||
form->LoadValue (18 ,new TCollection_HAsciiString(iges->LineWeightNumber()) );
|
||||
|
||||
form->LoadValue (19 ,DefTypeName (iges->DefColor()) );
|
||||
form->LoadValue (20 ,new TCollection_HAsciiString(iges->RankColor()) );
|
||||
if (iges->DefColor() == IGESData_DefReference)
|
||||
form->LoadValue (21 ,modl->StringLabel(iges->Color()) );
|
||||
|
||||
form->LoadValue (22 ,iges->ShortLabel());
|
||||
if (iges->HasSubScriptNumber()) form->LoadValue (23 ,new TCollection_HAsciiString(iges->SubScriptNumber()) );
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean IGESSelect_EditDirPart::Update
|
||||
(const Handle(IFSelect_EditForm)& form,
|
||||
const Standard_Integer num,
|
||||
const Handle(TCollection_HAsciiString)& val,
|
||||
const Standard_Boolean enforce) const
|
||||
{
|
||||
Handle(TCollection_HAsciiString) nulstr;
|
||||
Handle(IGESData_IGESModel) modl =
|
||||
Handle(IGESData_IGESModel)::DownCast(form->Model());
|
||||
|
||||
// LineFont
|
||||
if (num == 5) {
|
||||
if (val.IsNull()) form->Touch (4,DefTypeName(IGESData_DefVoid));
|
||||
else form->Touch (4,DefTypeName(IGESData_DefValue));
|
||||
}
|
||||
if (num == 6) {
|
||||
if (val.IsNull()) form->Touch (4,DefTypeName(IGESData_DefVoid));
|
||||
else form->Touch (4,DefTypeName(IGESData_DefReference));
|
||||
}
|
||||
|
||||
// Level
|
||||
if (num == 8) {
|
||||
if (val.IsNull()) form->Touch (7,DefListName(IGESData_DefNone));
|
||||
else form->Touch (7,DefListName(IGESData_DefOne));
|
||||
}
|
||||
if (num == 9) {
|
||||
if (val.IsNull()) form->Touch (7,DefListName(IGESData_DefNone));
|
||||
else form->Touch (7,DefListName(IGESData_DefSeveral));
|
||||
}
|
||||
|
||||
// View
|
||||
if (num == 11) {
|
||||
if (val.IsNull()) form->Touch (10,DefListName(IGESData_DefNone));
|
||||
else form->Touch (10,DefListName(IGESData_DefOne));
|
||||
}
|
||||
|
||||
// Color
|
||||
if (num == 20) {
|
||||
if (val.IsNull()) form->Touch (19,DefTypeName(IGESData_DefVoid));
|
||||
else form->Touch (19,DefTypeName(IGESData_DefValue));
|
||||
}
|
||||
if (num == 21) {
|
||||
if (val.IsNull()) form->Touch (19,DefTypeName(IGESData_DefVoid));
|
||||
else form->Touch (19,DefTypeName(IGESData_DefReference));
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean IGESSelect_EditDirPart::Apply
|
||||
(const Handle(IFSelect_EditForm)& form,
|
||||
const Handle(Standard_Transient)& ent,
|
||||
const Handle(Interface_InterfaceModel)& model) const
|
||||
{
|
||||
Handle(IGESData_IGESModel) modl =
|
||||
Handle(IGESData_IGESModel)::DownCast(model);
|
||||
if (modl.IsNull()) return Standard_False;
|
||||
Handle(IGESData_IGESEntity) iges =
|
||||
Handle(IGESData_IGESEntity)::DownCast(ent);
|
||||
if (iges.IsNull()) return Standard_False;
|
||||
Handle(IGESData_IGESEntity) sub;
|
||||
Handle(IGESData_LineFontEntity) lfent;
|
||||
Handle(IGESData_LevelListEntity) levlist;
|
||||
Handle(IGESData_ViewKindEntity) view;
|
||||
Handle(IGESData_TransfEntity) transf;
|
||||
Handle(IGESData_LabelDisplayEntity) labdisp;
|
||||
Handle(IGESData_ColorEntity) color;
|
||||
|
||||
Handle(TCollection_HAsciiString) str;
|
||||
Standard_Integer num;
|
||||
|
||||
if (form->IsModified (3)) {
|
||||
str = form->EditedValue(3);
|
||||
sub.Nullify();
|
||||
num = 0;
|
||||
if (!str.IsNull()) num = modl->NextNumberForLabel (str->ToCString());
|
||||
else num = -1;
|
||||
if (num > 0) sub = modl->Entity(num);
|
||||
if (num != 0) iges->InitDirFieldEntity (3,sub);
|
||||
}
|
||||
|
||||
if (form->IsModified(5)) {
|
||||
str = form->EditedValue(5);
|
||||
lfent.Nullify();
|
||||
if (str.IsNull()) num = 0;
|
||||
else num = str->IntegerValue();
|
||||
iges->InitLineFont (lfent,num);
|
||||
}
|
||||
if (form->IsModified(6)) {
|
||||
str = form->EditedValue(6);
|
||||
lfent.Nullify();
|
||||
num = 0;
|
||||
if (str.IsNull()) num = -1;
|
||||
else num = modl->NextNumberForLabel (str->ToCString());
|
||||
if (num > 0) lfent = GetCasted(IGESData_LineFontEntity,modl->Entity(num));
|
||||
if (num < 0 || !lfent.IsNull()) iges->InitLineFont (lfent,0);
|
||||
}
|
||||
|
||||
if (form->IsModified(8)) {
|
||||
str = form->EditedValue(8);
|
||||
levlist.Nullify();
|
||||
if (str.IsNull()) num = 0;
|
||||
else num = str->IntegerValue();
|
||||
iges->InitLevel (levlist,num);
|
||||
}
|
||||
if (form->IsModified(9)) {
|
||||
str = form->EditedValue(9);
|
||||
levlist.Nullify();
|
||||
num = 0;
|
||||
if (str.IsNull()) num = -1;
|
||||
else num = modl->NextNumberForLabel (str->ToCString());
|
||||
if (num > 0) levlist = GetCasted(IGESData_LevelListEntity,modl->Entity(num));
|
||||
if (num < 0 || !levlist.IsNull()) iges->InitLevel (levlist,0);
|
||||
}
|
||||
|
||||
if (form->IsModified(11)) {
|
||||
str = form->EditedValue(11);
|
||||
view.Nullify();
|
||||
num = 0;
|
||||
if (!str.IsNull()) num = modl->NextNumberForLabel (str->ToCString());
|
||||
else num = -1;
|
||||
if (num > 0) view = GetCasted(IGESData_ViewKindEntity,modl->Entity(num));
|
||||
if (num != 0 || !view.IsNull()) iges->InitView (view);
|
||||
}
|
||||
|
||||
if (form->IsModified(12)) {
|
||||
str = form->EditedValue(12);
|
||||
transf.Nullify();
|
||||
num = 0;
|
||||
if (!str.IsNull()) num = modl->NextNumberForLabel (str->ToCString());
|
||||
else num = -1;
|
||||
if (num > 0) transf = GetCasted(IGESData_TransfEntity,modl->Entity(num));
|
||||
if (num != 0 || !transf.IsNull()) iges->InitTransf (transf);
|
||||
}
|
||||
|
||||
if (form->IsModified(13)) {
|
||||
str = form->EditedValue(13);
|
||||
labdisp.Nullify();
|
||||
num = 0;
|
||||
if (!str.IsNull()) num = modl->NextNumberForLabel (str->ToCString());
|
||||
else num = -1;
|
||||
if (num > 0) labdisp = GetCasted(IGESData_LabelDisplayEntity,modl->Entity(num));
|
||||
if (num != 0 || !labdisp.IsNull()) iges->InitDirFieldEntity (8,labdisp);
|
||||
}
|
||||
|
||||
if (form->IsModified(14) || form->IsModified(15) ||
|
||||
form->IsModified(16) || form->IsModified(17)) {
|
||||
Standard_Integer n1,n2,n3,n4;
|
||||
n1 = iges->BlankStatus();
|
||||
n2 = iges->SubordinateStatus();
|
||||
n3 = iges->UseFlag();
|
||||
n4 = iges->HierarchyStatus();
|
||||
if (form->IsModified(14)) n1 = form->EditedValue(14)->IntegerValue();
|
||||
if (form->IsModified(15)) n2 = form->EditedValue(15)->IntegerValue();
|
||||
if (form->IsModified(16)) n3 = form->EditedValue(16)->IntegerValue();
|
||||
if (form->IsModified(17)) n4 = form->EditedValue(17)->IntegerValue();
|
||||
iges->InitStatus (n1,n2,n3,n4);
|
||||
}
|
||||
|
||||
if (form->IsModified(18)) {
|
||||
str = form->EditedValue(18);
|
||||
num = 0;
|
||||
if (!str.IsNull()) num = str->IntegerValue();
|
||||
iges->InitMisc (iges->Structure(),iges->LabelDisplay(),num);
|
||||
}
|
||||
|
||||
if (form->IsModified(20)) {
|
||||
str = form->EditedValue(20);
|
||||
color.Nullify();
|
||||
if (str.IsNull()) num = 0;
|
||||
else num = str->IntegerValue();
|
||||
iges->InitColor (color,num);
|
||||
}
|
||||
if (form->IsModified(21)) {
|
||||
str = form->EditedValue(21);
|
||||
color.Nullify();
|
||||
num = 0;
|
||||
if (str.IsNull()) num = -1;
|
||||
else num = modl->NextNumberForLabel (str->ToCString());
|
||||
if (num > 0) color = GetCasted(IGESData_ColorEntity,modl->Entity(num));
|
||||
if (num < 0 || !color.IsNull()) iges->InitColor (color,0);
|
||||
}
|
||||
|
||||
if (form->IsModified(22) || form->IsModified(23)) {
|
||||
num = -1;
|
||||
if (iges->HasSubScriptNumber()) num = iges->SubScriptNumber();
|
||||
if (form->IsModified(23)) {
|
||||
str = form->EditedValue(23);
|
||||
if (str.IsNull()) num = -1;
|
||||
else num = str->IntegerValue();
|
||||
}
|
||||
str = iges->ShortLabel();
|
||||
if (form->IsModified(22)) str = form->EditedValue(22);
|
||||
iges->SetLabel (str,num);
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
37
src/IGESSelect/IGESSelect_EditHeader.cdl
Executable file
37
src/IGESSelect/IGESSelect_EditHeader.cdl
Executable file
@@ -0,0 +1,37 @@
|
||||
-- File: IGESSelect_EditHeader.cdl
|
||||
-- Created: Fri Jul 31 10:54:50 1998
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@heliox.paris1.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 1998
|
||||
|
||||
|
||||
class EditHeader from IGESSelect inherits Editor from IFSelect
|
||||
|
||||
---Purpose : This class is aimed to display and edit the Header of an
|
||||
-- IGES Model : Start Section and Global Section
|
||||
|
||||
uses Transient, AsciiString, HAsciiString, InterfaceModel, EditForm
|
||||
|
||||
is
|
||||
|
||||
Create returns EditHeader;
|
||||
|
||||
Label (me) returns AsciiString;
|
||||
|
||||
Recognize (me; form : EditForm) returns Boolean;
|
||||
|
||||
StringValue (me; form : EditForm; num : Integer)
|
||||
returns HAsciiString from TCollection;
|
||||
|
||||
Load (me; form : EditForm; ent : Transient; model : InterfaceModel)
|
||||
returns Boolean;
|
||||
|
||||
Update (me; form : mutable EditForm; num : Integer;
|
||||
newval : HAsciiString; enforce : Boolean)
|
||||
returns Boolean is redefined;
|
||||
-- for dynamically computed values
|
||||
|
||||
Apply (me; form : EditForm; ent : Transient; model : InterfaceModel)
|
||||
returns Boolean;
|
||||
|
||||
end EditHeader;
|
351
src/IGESSelect/IGESSelect_EditHeader.cxx
Executable file
351
src/IGESSelect/IGESSelect_EditHeader.cxx
Executable file
@@ -0,0 +1,351 @@
|
||||
#include <IGESSelect_EditHeader.ixx>
|
||||
#include <Interface_TypedValue.hxx>
|
||||
#include <Interface_Static.hxx>
|
||||
|
||||
#include <IGESData_IGESModel.hxx>
|
||||
#include <IGESData_Protocol.hxx>
|
||||
#include <IGESData_GlobalSection.hxx>
|
||||
#include <IGESData_BasicEditor.hxx>
|
||||
|
||||
|
||||
static Standard_Boolean IsTimeStamp
|
||||
(const Handle(TCollection_HAsciiString)& val)
|
||||
{
|
||||
if (val.IsNull()) return Standard_False;
|
||||
// La date peut etre sur 13 ou 15 caracteres (15 : bonjour l an 2000!)
|
||||
// forme [YY]YYMMDD.HHMMSS
|
||||
Standard_Integer lng = val->Length();
|
||||
if (lng != 13 && lng != 15) return Standard_False;
|
||||
lng -= 13; // devient 0 ou 2 (offset siecle)
|
||||
|
||||
// Cas du siecle present :
|
||||
if (lng == 2) {
|
||||
char uncar = val->Value(1);
|
||||
if (uncar != '1' && uncar != '2') return Standard_False;
|
||||
uncar = val->Value(2);
|
||||
if (uncar < '0' || uncar > '9') return Standard_False;
|
||||
}
|
||||
|
||||
// On y va
|
||||
char dizmois = val->Value(lng+3);
|
||||
char dizjour = val->Value(lng+5);
|
||||
char dizheur = val->Value(lng+8);
|
||||
for (Standard_Integer i = 1; i <= 13; i ++) {
|
||||
char uncar = val->Value(i+lng);
|
||||
switch (i) {
|
||||
case 1 :
|
||||
case 2 : if (uncar < '0' || uncar > '9') return Standard_False; break;
|
||||
case 3 : if (uncar != '0' && uncar != '1') return Standard_False; break;
|
||||
case 4 : if (uncar < '0' || uncar > '9') return Standard_False;
|
||||
if (dizmois == '1' && (uncar < '0' || uncar > '2')) return Standard_False;
|
||||
break;
|
||||
case 5 : if (uncar < '0' || uncar > '3') return Standard_False; break;
|
||||
case 6 : if (uncar < '0' || uncar > '9') return Standard_False;
|
||||
if (dizjour == '3' && (uncar != '0' && uncar != '1')) return Standard_False;
|
||||
break;
|
||||
case 7 : if (uncar != '.') return Standard_False; break;
|
||||
case 8 : if (uncar < '0' || uncar > '2') return Standard_False; break;
|
||||
case 9 : if (uncar < '0' || uncar > '9') return Standard_False;
|
||||
if (dizheur == '2' && (uncar < '0' || uncar > '3')) return Standard_False; //szv#4:S4163:12Mar99 extra break
|
||||
break;
|
||||
case 10 : if (uncar < '0' || uncar > '5') return Standard_False; break;
|
||||
case 11 : if (uncar < '0' || uncar > '9') return Standard_False; break;
|
||||
case 12 : if (uncar < '0' || uncar > '5') return Standard_False; break;
|
||||
case 13 : if (uncar < '0' || uncar > '9') return Standard_False; break;
|
||||
default : break;
|
||||
}
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
IGESSelect_EditHeader::IGESSelect_EditHeader ()
|
||||
: IFSelect_Editor (30)
|
||||
{
|
||||
Standard_Integer i,nb;
|
||||
// Definition
|
||||
Handle(Interface_TypedValue) start = new Interface_TypedValue("Start Section");
|
||||
start->SetMaxLength(72);
|
||||
SetValue (1,start,"Start");
|
||||
SetList (1);
|
||||
|
||||
Handle(Interface_TypedValue) sep = new Interface_TypedValue("Parameter Delimiter");
|
||||
sep->SetMaxLength(1);
|
||||
SetValue (2,sep,"G1:Separator",IFSelect_Optional);
|
||||
Handle(Interface_TypedValue) endmark = new Interface_TypedValue("Record Delimiter");
|
||||
endmark->SetMaxLength(1);
|
||||
SetValue (3,endmark,"G2:EndMark",IFSelect_Optional);
|
||||
|
||||
Handle(Interface_TypedValue) sendname = new Interface_TypedValue("Sender Product Id");
|
||||
SetValue (4,sendname,"G3:SendName",IFSelect_Optional);
|
||||
|
||||
Handle(Interface_TypedValue) filename = new Interface_TypedValue("File Name");
|
||||
SetValue (5,filename,"G4:FileName");
|
||||
|
||||
Handle(Interface_TypedValue) systid = new Interface_TypedValue("Native System Id");
|
||||
SetValue (6,systid,"G5:SystemId");
|
||||
|
||||
Handle(Interface_TypedValue) version = new Interface_TypedValue("Preprocessor Version");
|
||||
SetValue (7,version,"G6:Version");
|
||||
|
||||
Handle(Interface_TypedValue) intbits = new Interface_TypedValue("Integer Binary Bits",Interface_ParamInteger);
|
||||
SetValue (8,intbits,"G7:IntBits");
|
||||
Handle(Interface_TypedValue) pow10s = new Interface_TypedValue("Single Precision Magnitude",Interface_ParamInteger);
|
||||
SetValue (9,pow10s,"G8:SingleMag");
|
||||
Handle(Interface_TypedValue) dig10s = new Interface_TypedValue("Single Precision Significance",Interface_ParamInteger);
|
||||
SetValue (10,dig10s,"G9:SingDigits");
|
||||
Handle(Interface_TypedValue) pow10d = new Interface_TypedValue("Double Precision Magnitude",Interface_ParamInteger);
|
||||
SetValue (11,pow10d,"G10:DoubleMag");
|
||||
Handle(Interface_TypedValue) dig10d = new Interface_TypedValue("Double Precision Significance",Interface_ParamInteger);
|
||||
SetValue (12,dig10d,"G11:DoubDigits");
|
||||
|
||||
Handle(Interface_TypedValue) recname = new Interface_TypedValue("Receiver Product Id");
|
||||
SetValue (13,recname,"G12:Receiver",IFSelect_Optional);
|
||||
|
||||
Handle(Interface_TypedValue) scale = new Interface_TypedValue("Model Space Scale",Interface_ParamReal);
|
||||
SetValue (14,scale,"G13:Scale",IFSelect_Optional);
|
||||
|
||||
Handle(Interface_TypedValue) unitflag = new Interface_TypedValue("Units Flag",Interface_ParamInteger);
|
||||
unitflag->SetIntegerLimit(Standard_False,1);
|
||||
unitflag->SetIntegerLimit(Standard_True,11);
|
||||
SetValue (15,unitflag,"G14:UnitFlag",IFSelect_Optional);
|
||||
// On prend a la source ... Mieux vaudrait "recopier" les definitions ...
|
||||
Handle(Interface_TypedValue) unitname = new Interface_TypedValue("Units Name",Interface_ParamEnum);
|
||||
unitname->StartEnum (1);
|
||||
for (i = 1; i <= 11; i ++)
|
||||
unitname->AddEnumValue (IGESData_BasicEditor::UnitFlagName(i),i);
|
||||
// similaire a Interface_Static::Static("XSTEP.iges.unit");
|
||||
SetValue (16,unitname,"G15:UnitName",IFSelect_Optional);
|
||||
Handle(Interface_TypedValue) unitval = new Interface_TypedValue("Computed Unit Value",Interface_ParamReal);
|
||||
SetValue (17,unitval,"V15:UnitValue",IFSelect_EditDynamic);
|
||||
|
||||
Handle(Interface_TypedValue) linwgr = new Interface_TypedValue("Max Line Weight Gradation",Interface_ParamInteger);
|
||||
SetValue (18,linwgr,"G16:LineWGrad",IFSelect_Optional);
|
||||
Handle(Interface_TypedValue) maxlw = new Interface_TypedValue("Width of Max Line Weight",Interface_ParamReal);
|
||||
SetValue (19,maxlw,"G17:MaxLineW");
|
||||
|
||||
Handle(Interface_TypedValue) filedate = new Interface_TypedValue("Date of File Creation");
|
||||
filedate->SetSatisfies (IsTimeStamp,"IsIGESDate");
|
||||
SetValue (20,filedate,"G18:FileDate");
|
||||
|
||||
Handle(Interface_TypedValue) resol = new Interface_TypedValue("Max Resolution",Interface_ParamReal);
|
||||
SetValue (21,resol,"G19:Resolution");
|
||||
Handle(Interface_TypedValue) coord = new Interface_TypedValue("Max Coordinates",Interface_ParamReal);
|
||||
SetValue (22,coord,"G20:MaxCoord",IFSelect_Optional);
|
||||
|
||||
Handle(Interface_TypedValue) author = new Interface_TypedValue("Name of Author");
|
||||
SetValue (23,author,"G21:Author");
|
||||
Handle(Interface_TypedValue) company = new Interface_TypedValue("Author Organization");
|
||||
SetValue (24,company,"G22:Company");
|
||||
|
||||
Handle(Interface_TypedValue) igesvers = new Interface_TypedValue("Version Flag",Interface_ParamInteger);
|
||||
nb = IGESData_BasicEditor::IGESVersionMax();
|
||||
igesvers->SetIntegerLimit(Standard_False,1);
|
||||
igesvers->SetIntegerLimit(Standard_True,nb);
|
||||
SetValue (25,igesvers,"G23:IGESVersion");
|
||||
Handle(Interface_TypedValue) versname = new Interface_TypedValue("IGES Version Name",Interface_ParamEnum);
|
||||
versname->StartEnum (0);
|
||||
for (i = 0; i <= IGESData_BasicEditor::IGESVersionMax(); i ++)
|
||||
versname->AddEnumValue (IGESData_BasicEditor::IGESVersionName(i),i);
|
||||
SetValue (26,versname,"V23:VersionName");
|
||||
|
||||
Handle(Interface_TypedValue) draft = new Interface_TypedValue("Drafting Standard Flag",Interface_ParamInteger);
|
||||
nb = IGESData_BasicEditor::DraftingMax();
|
||||
draft->SetIntegerLimit(Standard_False,0);
|
||||
draft->SetIntegerLimit(Standard_True,nb);
|
||||
SetValue (27,draft,"G24:Drafting");
|
||||
Handle(Interface_TypedValue) draftname = new Interface_TypedValue("Drafting Standard Name",Interface_ParamEnum);
|
||||
draftname->StartEnum (0);
|
||||
for (i = 0; i <= nb; i ++)
|
||||
draftname->AddEnumValue (IGESData_BasicEditor::DraftingName(i),i);
|
||||
SetValue (28,draftname,"V24:DraftingName");
|
||||
|
||||
Handle(Interface_TypedValue) changedate = new Interface_TypedValue("Date of Creation/Change");
|
||||
changedate->SetSatisfies (IsTimeStamp,"IsIGESDate");
|
||||
SetValue (29,changedate,"G25:ChangeDate",IFSelect_Optional);
|
||||
|
||||
Handle(Interface_TypedValue) proto = new Interface_TypedValue("Application Protocol/Subset Id");
|
||||
SetValue (30,proto,"G26:Protocol",IFSelect_Optional);
|
||||
|
||||
}
|
||||
|
||||
TCollection_AsciiString IGESSelect_EditHeader::Label () const
|
||||
{ return TCollection_AsciiString ("IGES Header"); }
|
||||
|
||||
Standard_Boolean IGESSelect_EditHeader::Recognize
|
||||
(const Handle(IFSelect_EditForm)& form) const
|
||||
{ return Standard_True; } // ??
|
||||
|
||||
Handle(TCollection_HAsciiString) IGESSelect_EditHeader::StringValue
|
||||
(const Handle(IFSelect_EditForm)& form, const Standard_Integer num) const
|
||||
{
|
||||
// Default Values
|
||||
return TypedValue(num)->HStringValue();
|
||||
}
|
||||
|
||||
Standard_Boolean IGESSelect_EditHeader::Load
|
||||
(const Handle(IFSelect_EditForm)& form,
|
||||
const Handle(Standard_Transient)& ent,
|
||||
const Handle(Interface_InterfaceModel)& model) const
|
||||
{
|
||||
Handle(IGESData_IGESModel) modl =
|
||||
Handle(IGESData_IGESModel)::DownCast(model);
|
||||
if (modl.IsNull()) return Standard_False;
|
||||
|
||||
IGESData_GlobalSection GS = modl->GlobalSection();
|
||||
|
||||
form->LoadList (1 ,modl->StartSection());
|
||||
form->LoadValue (2 ,new TCollection_HAsciiString(GS.Separator()) );
|
||||
form->LoadValue (3 ,new TCollection_HAsciiString(GS.EndMark()) );
|
||||
form->LoadValue (4 ,GS.SendName());
|
||||
form->LoadValue (5 ,GS.FileName());
|
||||
form->LoadValue (6 ,GS.SystemId());
|
||||
form->LoadValue (7 ,GS.InterfaceVersion());
|
||||
|
||||
form->LoadValue (8 ,new TCollection_HAsciiString(GS.IntegerBits()) );
|
||||
form->LoadValue (9 ,new TCollection_HAsciiString(GS.MaxPower10Single()) );
|
||||
form->LoadValue (10 ,new TCollection_HAsciiString(GS.MaxDigitsSingle()) );
|
||||
form->LoadValue (11 ,new TCollection_HAsciiString(GS.MaxPower10Double()) );
|
||||
form->LoadValue (12 ,new TCollection_HAsciiString(GS.MaxDigitsDouble()) );
|
||||
|
||||
form->LoadValue (13 ,GS.ReceiveName());
|
||||
form->LoadValue (14 ,new TCollection_HAsciiString(GS.Scale()) );
|
||||
|
||||
form->LoadValue (15 ,new TCollection_HAsciiString(GS.UnitFlag()) );
|
||||
form->LoadValue (16 ,GS.UnitName());
|
||||
form->LoadValue (17 ,new TCollection_HAsciiString(GS.UnitValue()) );
|
||||
form->LoadValue (18 ,new TCollection_HAsciiString(GS.LineWeightGrad()) );
|
||||
form->LoadValue (19 ,new TCollection_HAsciiString(GS.MaxLineWeight()) );
|
||||
|
||||
form->LoadValue (20 ,GS.Date());
|
||||
form->LoadValue (21 ,new TCollection_HAsciiString(GS.Resolution()) );
|
||||
if (GS.HasMaxCoord()) form->LoadValue (22 ,new TCollection_HAsciiString(GS.MaxCoord()) );
|
||||
|
||||
form->LoadValue (23 ,GS.AuthorName());
|
||||
form->LoadValue (24 ,GS.CompanyName());
|
||||
form->LoadValue (25 ,new TCollection_HAsciiString(GS.IGESVersion()) );
|
||||
form->LoadValue (26 ,new TCollection_HAsciiString
|
||||
(IGESData_BasicEditor::IGESVersionName(GS.IGESVersion()) ));
|
||||
form->LoadValue (27 ,new TCollection_HAsciiString(GS.DraftingStandard()) );
|
||||
form->LoadValue (28 ,new TCollection_HAsciiString
|
||||
(IGESData_BasicEditor::DraftingName(GS.DraftingStandard()) ));
|
||||
form->LoadValue (29 ,GS.LastChangeDate());
|
||||
form->LoadValue (30 ,GS.ApplicationProtocol());
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean IGESSelect_EditHeader::Update
|
||||
(const Handle(IFSelect_EditForm)& form,
|
||||
const Standard_Integer num,
|
||||
const Handle(TCollection_HAsciiString)& val,
|
||||
const Standard_Boolean enforce) const
|
||||
{
|
||||
if (num == 15) {
|
||||
if (!enforce) return Standard_False; // quand meme ...
|
||||
// Unit Flag : mettre a jour UnitName et UnitValue
|
||||
Standard_Integer unitflag = val->IntegerValue();
|
||||
Standard_CString unitname = IGESData_BasicEditor::UnitFlagName (unitflag);
|
||||
if (unitname[0] == '\0') return Standard_False;
|
||||
form->Touch (16,new TCollection_HAsciiString (unitname));
|
||||
form->Touch (17,new TCollection_HAsciiString
|
||||
(IGESData_BasicEditor::UnitFlagValue(unitflag)) );
|
||||
}
|
||||
if (num == 16) {
|
||||
if (!enforce) return Standard_False; // quand meme ...
|
||||
// Unit Name : mettre a jour UnitFlag et UnitValue
|
||||
Standard_Integer unitflag = IGESData_BasicEditor::UnitNameFlag
|
||||
(val->ToCString());
|
||||
if (unitflag == 0) return Standard_False; // pas bon
|
||||
form->Touch (15,new TCollection_HAsciiString (unitflag));
|
||||
form->Touch (17,new TCollection_HAsciiString
|
||||
(IGESData_BasicEditor::UnitFlagValue(unitflag)) );
|
||||
}
|
||||
|
||||
if (num == 25) {
|
||||
// Unit Version : mettre a jour son nom
|
||||
Standard_Integer version = 3; // par defaut ...
|
||||
if (!val.IsNull()) version = atoi(val->ToCString());
|
||||
Standard_CString versname = IGESData_BasicEditor::IGESVersionName(version);
|
||||
if (versname[0] == '\0') return Standard_False;
|
||||
form->Touch (26,new TCollection_HAsciiString (versname));
|
||||
}
|
||||
if (num == 27) {
|
||||
// Drafting : mettre a jour son nom
|
||||
Standard_Integer draft = 0;
|
||||
if (!val.IsNull()) draft = atoi(val->ToCString());
|
||||
Standard_CString draftname = IGESData_BasicEditor::IGESVersionName(draft);
|
||||
if (draftname[0] == '\0') return Standard_False;
|
||||
form->Touch (28,new TCollection_HAsciiString (draftname));
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean IGESSelect_EditHeader::Apply
|
||||
(const Handle(IFSelect_EditForm)& form,
|
||||
const Handle(Standard_Transient)& ent,
|
||||
const Handle(Interface_InterfaceModel)& model) const
|
||||
{
|
||||
Handle(IGESData_IGESModel) modl =
|
||||
Handle(IGESData_IGESModel)::DownCast(model);
|
||||
if (modl.IsNull()) return Standard_False;
|
||||
|
||||
IGESData_GlobalSection GS = modl->GlobalSection();
|
||||
|
||||
Handle(TCollection_HAsciiString) str;
|
||||
|
||||
if (form->IsModified(1)) modl->SetStartSection (form->EditedList(1));
|
||||
if (form->IsModified(2)) {
|
||||
str = form->EditedValue(2);
|
||||
if (!str.IsNull() && str->Length() >= 1) GS.SetSeparator (str->Value(1));
|
||||
}
|
||||
if (form->IsModified(3)) {
|
||||
str = form->EditedValue(3);
|
||||
if (!str.IsNull() && str->Length() >= 1) GS.SetEndMark (str->Value(1));
|
||||
}
|
||||
if (form->IsModified(4)) GS.SetSendName (form->EditedValue(4));
|
||||
if (form->IsModified(5)) GS.SetFileName (form->EditedValue(5));
|
||||
if (form->IsModified(6)) GS.SetSystemId (form->EditedValue(6));
|
||||
if (form->IsModified(7)) GS.SetInterfaceVersion (form->EditedValue(7));
|
||||
|
||||
if (form->IsModified(8)) GS.SetIntegerBits (form->EditedValue(8)->IntegerValue());
|
||||
if (form->IsModified(9)) GS.SetMaxPower10Single (form->EditedValue(9)->IntegerValue());
|
||||
if (form->IsModified(10)) GS.SetMaxDigitsSingle (form->EditedValue(10)->IntegerValue());
|
||||
if (form->IsModified(11)) GS.SetMaxPower10Double (form->EditedValue(11)->IntegerValue());
|
||||
if (form->IsModified(12)) GS.SetMaxDigitsDouble (form->EditedValue(12)->IntegerValue());
|
||||
|
||||
if (form->IsModified(13)) GS.SetReceiveName (form->EditedValue(13));
|
||||
if (form->IsModified(14)) GS.SetScale (form->EditedValue(14)->RealValue());
|
||||
if (form->IsModified(15)) GS.SetUnitFlag (form->EditedValue(15)->IntegerValue());
|
||||
if (form->IsModified(16)) GS.SetUnitName (form->EditedValue(16));
|
||||
|
||||
if (form->IsModified(18)) GS.SetLineWeightGrad (form->EditedValue(18)->IntegerValue());
|
||||
if (form->IsModified(19)) GS.SetMaxLineWeight (form->EditedValue(19)->RealValue());
|
||||
|
||||
if (form->IsModified(20)) GS.SetDate (form->EditedValue(20));
|
||||
if (form->IsModified(21)) GS.SetResolution (form->EditedValue(21)->RealValue());
|
||||
if (form->IsModified(22)) {
|
||||
str = form->EditedValue(22);
|
||||
if (str.IsNull()) GS.SetMaxCoord();
|
||||
else GS.SetMaxCoord (str->RealValue());
|
||||
}
|
||||
|
||||
if (form->IsModified(23)) GS.SetAuthorName (form->EditedValue(23));
|
||||
if (form->IsModified(24)) GS.SetCompanyName (form->EditedValue(24));
|
||||
if (form->IsModified(25)) GS.SetIGESVersion (form->EditedValue(25)->IntegerValue());
|
||||
if (form->IsModified(27)) GS.SetDraftingStandard (form->EditedValue(27)->IntegerValue());
|
||||
if (form->IsModified(29)) GS.SetLastChangeDate (form->EditedValue(29));
|
||||
if (form->IsModified(30)) GS.SetApplicationProtocol (form->EditedValue(30));
|
||||
|
||||
modl->SetGlobalSection (GS);
|
||||
|
||||
// Pour l unite
|
||||
if (form->IsModified(15) || form->IsModified(16)) {
|
||||
IGESData_BasicEditor bed
|
||||
(modl,Handle(IGESData_Protocol)::DownCast(modl->Protocol()) );
|
||||
if (bed.SetUnitValue (GS.UnitValue()) ) return Standard_False;
|
||||
bed.ApplyUnit (Standard_True);
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
83
src/IGESSelect/IGESSelect_FloatFormat.cdl
Executable file
83
src/IGESSelect/IGESSelect_FloatFormat.cdl
Executable file
@@ -0,0 +1,83 @@
|
||||
-- File: IGESSelect_FloatFormat.cdl
|
||||
-- Created: Wed Jun 1 16:04:47 1994
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@bravox>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
class FloatFormat from IGESSelect inherits FileModifier from IGESSelect
|
||||
|
||||
---Purpose : This class gives control out format for floatting values :
|
||||
-- ZeroSuppress or no, Main Format, Format in Range (for values
|
||||
-- around 1.), as IGESWriter allows to manage it.
|
||||
-- Formats are given under C-printf form
|
||||
|
||||
uses CString, AsciiString from TCollection,
|
||||
IGESWriter , ContextWrite
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable FloatFormat;
|
||||
---Purpose : Creates a new FloatFormat, with standard options :
|
||||
-- ZeroSuppress, Main Format = %E,
|
||||
-- Format between 0.001 and 1000. = %f
|
||||
|
||||
SetDefault (me : mutable; digits : Integer = 0);
|
||||
---Purpose : Sets FloatFormat to default value (see Create) but if <digits>
|
||||
-- is given positive, it commands Formats (main and range) to
|
||||
-- ensure <digits> significant digits to be displayed
|
||||
|
||||
SetZeroSuppress (me : mutable; mode : Boolean);
|
||||
---Purpose : Sets ZeroSuppress mode to a new value
|
||||
|
||||
SetFormat (me : mutable; format : CString = "%E");
|
||||
---Purpose : Sets Main Format to a new value
|
||||
-- Remark : SetFormat, SetZeroSuppress and SetFormatForRange are
|
||||
-- independant
|
||||
|
||||
SetFormatForRange (me : mutable; format : CString = "%f";
|
||||
Rmin : Real = 0.1; Rmax : Real = 1000.0);
|
||||
---Purpose : Sets Format for Range to a new value with its range of
|
||||
-- application.
|
||||
-- To cancel it, give format as "" (empty string)
|
||||
-- Remark that if the condition (0. < Rmin < Rmax) is not
|
||||
-- verified, this secondary format will be ignored.
|
||||
-- Moreover, this secondary format is intended to be used in a
|
||||
-- range around 1.
|
||||
|
||||
|
||||
Format (me; zerosup : out Boolean;
|
||||
mainform : out AsciiString from TCollection;
|
||||
hasrange : out Boolean;
|
||||
forminrange : out AsciiString from TCollection;
|
||||
rangemin, rangemax : out Real);
|
||||
---Purpose : Returns all recorded parameters :
|
||||
-- zerosup : ZeroSuppress status
|
||||
-- mainform : Main Format (which applies out of the range, or
|
||||
-- for every real if no range is set)
|
||||
-- hasrange : True if a FormatInRange is set, False else
|
||||
-- (following parameters do not apply if it is False)
|
||||
-- forminrange : Secondary Format (it applies inside the range)
|
||||
-- rangemin, rangemax : the range in which the secondary format
|
||||
-- applies
|
||||
|
||||
|
||||
Perform (me; ctx : in out ContextWrite;
|
||||
writer : in out IGESWriter);
|
||||
---Purpose : Sets the Floatting Formats of IGESWriter to the recorded
|
||||
-- parameters
|
||||
|
||||
Label (me) returns AsciiString from TCollection;
|
||||
---Purpose : Returns specific Label : for instance,
|
||||
-- "Float Format [ZeroSuppress] %E [, in range R1-R2 %f]"
|
||||
|
||||
fields
|
||||
|
||||
thezerosup : Boolean;
|
||||
themainform : AsciiString from TCollection;
|
||||
theformrange : AsciiString from TCollection;
|
||||
therangemin : Real;
|
||||
therangemax : Real;
|
||||
|
||||
end FloatFormat;
|
||||
|
92
src/IGESSelect/IGESSelect_FloatFormat.cxx
Executable file
92
src/IGESSelect/IGESSelect_FloatFormat.cxx
Executable file
@@ -0,0 +1,92 @@
|
||||
#include <IGESSelect_FloatFormat.ixx>
|
||||
#include <Interface_FloatWriter.hxx>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
|
||||
IGESSelect_FloatFormat::IGESSelect_FloatFormat ()
|
||||
: thezerosup (Standard_True) , themainform ("%E") ,
|
||||
theformrange ("%f") , therangemin (0.1) , therangemax (1000.)
|
||||
{ }
|
||||
|
||||
void IGESSelect_FloatFormat::SetDefault (const Standard_Integer digits)
|
||||
{
|
||||
themainform.Clear();
|
||||
theformrange.Clear();
|
||||
if (digits <= 0) {
|
||||
themainform.AssignCat ("%E");
|
||||
theformrange.AssignCat ("%f");
|
||||
} else {
|
||||
char format[20];
|
||||
char pourcent = '%'; char point = '.';
|
||||
sprintf(format, "%c%d%c%dE",pourcent,digits+2,point,digits);
|
||||
themainform.AssignCat (format);
|
||||
sprintf(format, "%c%d%c%df",pourcent,digits+2,point,digits);
|
||||
theformrange.AssignCat (format);
|
||||
}
|
||||
therangemin = 0.1; therangemax = 1000.;
|
||||
thezerosup = Standard_True;
|
||||
}
|
||||
|
||||
void IGESSelect_FloatFormat::SetZeroSuppress (const Standard_Boolean mode)
|
||||
{ thezerosup = mode; }
|
||||
|
||||
void IGESSelect_FloatFormat::SetFormat (const Standard_CString format)
|
||||
{ themainform.Clear(); themainform.AssignCat(format); }
|
||||
|
||||
|
||||
void IGESSelect_FloatFormat::SetFormatForRange
|
||||
(const Standard_CString form, const Standard_Real R1, const Standard_Real R2)
|
||||
{
|
||||
theformrange.Clear(); theformrange.AssignCat(form);
|
||||
therangemin = R1; therangemax = R2;
|
||||
}
|
||||
|
||||
void IGESSelect_FloatFormat::Format
|
||||
(Standard_Boolean& zerosup, TCollection_AsciiString& mainform,
|
||||
Standard_Boolean& hasrange, TCollection_AsciiString& formrange,
|
||||
Standard_Real& rangemin, Standard_Real& rangemax) const
|
||||
{
|
||||
zerosup = thezerosup;
|
||||
mainform = themainform;
|
||||
hasrange = (theformrange.Length() > 0);
|
||||
formrange = theformrange;
|
||||
rangemin = therangemin;
|
||||
rangemax = therangemax;
|
||||
}
|
||||
|
||||
|
||||
void IGESSelect_FloatFormat::Perform
|
||||
(IFSelect_ContextWrite& ctx,
|
||||
IGESData_IGESWriter& writer) const
|
||||
{
|
||||
writer.FloatWriter().SetFormat (themainform.ToCString());
|
||||
writer.FloatWriter().SetZeroSuppress (thezerosup);
|
||||
if (theformrange.Length() > 0) writer.FloatWriter().SetFormatForRange
|
||||
(theformrange.ToCString(), therangemin, therangemax);
|
||||
}
|
||||
|
||||
TCollection_AsciiString IGESSelect_FloatFormat::Label () const
|
||||
{
|
||||
TCollection_AsciiString lab("Float Format ");
|
||||
if (thezerosup) lab.AssignCat(" ZeroSup ");
|
||||
lab.AssignCat (themainform);
|
||||
if (theformrange.Length() > 0) {
|
||||
char mess[30];
|
||||
// sprintf(mess,", in range %f %f %s",
|
||||
// therangemin,therangemax,theformrange.ToCString());
|
||||
// lab.AssignCat(mess);
|
||||
// ... FloatFormat a droit aussi a un beau format pour son propre compte ...
|
||||
lab.AssignCat (", in range ");
|
||||
Standard_Integer convlen = Interface_FloatWriter::Convert
|
||||
(therangemin,mess,Standard_True,therangemin/2.,therangemax*2.,"%f","%f");
|
||||
mess[convlen] = ' '; mess[convlen+1] = '\0';
|
||||
lab.AssignCat(mess);
|
||||
convlen = Interface_FloatWriter::Convert
|
||||
(therangemax,mess,Standard_True,therangemin/2.,therangemax*2.,"%f","%f");
|
||||
mess[convlen] = ':'; mess[convlen+1] = '\0';
|
||||
lab.AssignCat(mess);
|
||||
lab.AssignCat(theformrange.ToCString());
|
||||
}
|
||||
return lab;
|
||||
}
|
27
src/IGESSelect/IGESSelect_IGESName.cdl
Executable file
27
src/IGESSelect/IGESSelect_IGESName.cdl
Executable file
@@ -0,0 +1,27 @@
|
||||
-- File: IGESSelect_IGESName.cdl
|
||||
-- Created: Wed Dec 21 13:01:09 1994
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@anion>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
class IGESName from IGESSelect inherits Signature from IFSelect
|
||||
|
||||
---Purpose : IGESName is a Signature specific to IGESNorm :
|
||||
-- it considers the Name of an IGESEntity as being its ShortLabel
|
||||
-- (some sending systems use name, not to identify entities, but
|
||||
-- ratjer to classify them)
|
||||
|
||||
uses CString, Transient, InterfaceModel
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable IGESName;
|
||||
---Purpose : Creates a Signature for IGES Name (reduced to ShortLabel,
|
||||
-- without SubscriptLabel or Long Name)
|
||||
|
||||
Value (me; ent : any Transient; model : InterfaceModel) returns CString;
|
||||
---Purpose : Returns the ShortLabel as being the Name of an IGESEntity
|
||||
-- If <ent> has no name, it returns empty string ""
|
||||
|
||||
end IGESName;
|
23
src/IGESSelect/IGESSelect_IGESName.cxx
Executable file
23
src/IGESSelect/IGESSelect_IGESName.cxx
Executable file
@@ -0,0 +1,23 @@
|
||||
#include <IGESSelect_IGESName.ixx>
|
||||
#include <IGESData_IGESEntity.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
|
||||
static char falsetype [] = "?";
|
||||
static char voidlabel [] = "";
|
||||
|
||||
|
||||
|
||||
IGESSelect_IGESName::IGESSelect_IGESName ()
|
||||
: IFSelect_Signature ("IGES Name (Short Label)") { }
|
||||
|
||||
Standard_CString IGESSelect_IGESName::Value
|
||||
(const Handle(Standard_Transient)& ent,
|
||||
const Handle(Interface_InterfaceModel)& model) const
|
||||
{
|
||||
DeclareAndCast(IGESData_IGESEntity,igesent,ent);
|
||||
if (igesent.IsNull()) return &falsetype[0];
|
||||
Handle(TCollection_HAsciiString) label = igesent->ShortLabel();
|
||||
if (label.IsNull()) return &voidlabel[0];
|
||||
return label->ToCString();
|
||||
}
|
35
src/IGESSelect/IGESSelect_IGESTypeForm.cdl
Executable file
35
src/IGESSelect/IGESSelect_IGESTypeForm.cdl
Executable file
@@ -0,0 +1,35 @@
|
||||
-- File: IGESSelect_IGESTypeForm.cdl
|
||||
-- Created: Tue May 31 14:16:19 1994
|
||||
-- Author: Modelistation
|
||||
-- <model@bravox>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
class IGESTypeForm from IGESSelect inherits Signature from IFSelect
|
||||
|
||||
---Purpose : IGESTypeForm is a Signature specific to the IGES Norm :
|
||||
-- it gives the signature under two possible forms :
|
||||
-- - as "mmm nnn", with "mmm" as IGES Type Number, and "nnn"
|
||||
-- as IGES From Number (even if = 0) [Default]
|
||||
-- - as "mmm" alone, which gives only the IGES Type Number
|
||||
|
||||
uses CString, Transient, InterfaceModel
|
||||
|
||||
is
|
||||
|
||||
Create (withform : Boolean = Standard_True) returns mutable IGESTypeForm;
|
||||
---Purpose : Creates a Signature for IGES Type & Form Numbers
|
||||
-- If <withform> is False, for IGES Type Number only
|
||||
|
||||
SetForm (me : mutable; withform : Boolean);
|
||||
---Purpose : Changes the mode for giving the Form Number
|
||||
|
||||
Value (me; ent : any Transient; model : InterfaceModel) returns CString;
|
||||
---Purpose : Returns the signature for IGES, "mmm nnn" or "mmm" according
|
||||
-- creation choice (Type & Form or Type only)
|
||||
|
||||
fields
|
||||
|
||||
theform : Boolean;
|
||||
|
||||
end IGESTypeForm;
|
44
src/IGESSelect/IGESSelect_IGESTypeForm.cxx
Executable file
44
src/IGESSelect/IGESSelect_IGESTypeForm.cxx
Executable file
@@ -0,0 +1,44 @@
|
||||
#include <IGESSelect_IGESTypeForm.ixx>
|
||||
#include <IGESData_IGESEntity.hxx>
|
||||
#include <IGESData_UndefinedEntity.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
static char falsetype [] = "?";
|
||||
static char typeval [30]; // une seule reponse a la fois ...
|
||||
|
||||
|
||||
|
||||
IGESSelect_IGESTypeForm::IGESSelect_IGESTypeForm
|
||||
(const Standard_Boolean withform)
|
||||
//JR/Hp
|
||||
: IFSelect_Signature ((Standard_CString ) (withform ? "IGES Type & Form Numbers" : "IGES Type Number"))
|
||||
//: IFSelect_Signature (withform ? "IGES Type & Form Numbers" : "IGES Type Number")
|
||||
{ theform = withform; }
|
||||
|
||||
void IGESSelect_IGESTypeForm::SetForm (const Standard_Boolean withform)
|
||||
{ theform = withform; thename.Clear();
|
||||
//JR/Hp
|
||||
Standard_CString astr = (Standard_CString ) (withform ? "IGES Type & Form Numbers" : "IGES Type Number") ;
|
||||
thename.AssignCat ( astr ); }
|
||||
// thename.AssignCat (withform ? "IGES Type & Form Numbers" : "IGES Type Number") ;
|
||||
|
||||
Standard_CString IGESSelect_IGESTypeForm::Value
|
||||
(const Handle(Standard_Transient)& ent,
|
||||
const Handle(Interface_InterfaceModel)& model) const
|
||||
{
|
||||
DeclareAndCast(IGESData_IGESEntity,igesent,ent);
|
||||
if (igesent.IsNull()) return &falsetype[0];
|
||||
Standard_Boolean unk = ent->IsKind(STANDARD_TYPE(IGESData_UndefinedEntity));
|
||||
Standard_Integer typenum = igesent->TypeNumber();
|
||||
Standard_Integer formnum = igesent->FormNumber();
|
||||
if (unk) {
|
||||
if (theform) sprintf (typeval,"%d %d (?)",typenum,formnum);
|
||||
else sprintf (typeval,"%d (?)",typenum);
|
||||
} else {
|
||||
if (theform) sprintf (typeval,"%d %d",typenum,formnum);
|
||||
else sprintf (typeval,"%d", typenum);
|
||||
}
|
||||
return &typeval[0];
|
||||
}
|
38
src/IGESSelect/IGESSelect_RebuildDrawings.cdl
Executable file
38
src/IGESSelect/IGESSelect_RebuildDrawings.cdl
Executable file
@@ -0,0 +1,38 @@
|
||||
-- File: IGESSelect_RebuildDrawings.cdl
|
||||
-- Created: Wed Jun 1 18:18:26 1994
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@bravox>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
class RebuildDrawings from IGESSelect inherits ModelModifier from IGESSelect
|
||||
|
||||
---Purpose : Rebuilds Drawings which were bypassed to produce new models.
|
||||
-- If a set of entities, all put into a same IGESModel, were
|
||||
-- attached to a same Drawing in the starting Model, this Modifier
|
||||
-- rebuilds the original Drawing, but only with the transferred
|
||||
-- entities. This includes that all its views are kept too, but
|
||||
-- empty; and annotations are not kept. Drawing Name is renewed.
|
||||
--
|
||||
-- If the Input Selection is present, tries to rebuild Drawings
|
||||
-- only for the selected entities. Else, tries to rebuild
|
||||
-- Drawings for all the transferred entities.
|
||||
|
||||
uses AsciiString from TCollection,
|
||||
IGESModel, CopyTool, ContextModif
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable RebuildDrawings;
|
||||
---Purpose : Creates an RebuildDrawings, which uses the system Date
|
||||
|
||||
Performing (me; ctx : in out ContextModif;
|
||||
target : mutable IGESModel;
|
||||
TC : in out CopyTool);
|
||||
---Purpose : Specific action : Rebuilds the original Drawings
|
||||
|
||||
Label (me) returns AsciiString from TCollection;
|
||||
---Purpose : Returns a text which is
|
||||
-- "Rebuild Drawings"
|
||||
|
||||
end RebuildDrawings;
|
160
src/IGESSelect/IGESSelect_RebuildDrawings.cxx
Executable file
160
src/IGESSelect/IGESSelect_RebuildDrawings.cxx
Executable file
@@ -0,0 +1,160 @@
|
||||
#include <IGESSelect_RebuildDrawings.ixx>
|
||||
#include <IGESSelect_ViewSorter.hxx>
|
||||
#include <IFSelect_PacketList.hxx>
|
||||
#include <IGESData_IGESEntity.hxx>
|
||||
#include <IGESData_HArray1OfIGESEntity.hxx>
|
||||
#include <IGESDraw_Drawing.hxx>
|
||||
#include <IGESDraw_DrawingWithRotation.hxx>
|
||||
#include <IGESDraw_HArray1OfViewKindEntity.hxx>
|
||||
#include <IGESData_ViewKindEntity.hxx>
|
||||
#include <TColgp_HArray1OfXY.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
#include <gp_XY.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
|
||||
#include <Interface_EntityIterator.hxx>
|
||||
#include <Interface_Graph.hxx>
|
||||
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
|
||||
#define PourDrawing 404
|
||||
|
||||
|
||||
IGESSelect_RebuildDrawings::IGESSelect_RebuildDrawings ()
|
||||
: IGESSelect_ModelModifier (Standard_True) { }
|
||||
|
||||
|
||||
void IGESSelect_RebuildDrawings::Performing
|
||||
(IFSelect_ContextModif& ctx,
|
||||
const Handle(IGESData_IGESModel)& target,
|
||||
Interface_CopyTool& TC) const
|
||||
{
|
||||
// On reconstruit les drawings qui peuvent l etre
|
||||
// Pour chaque drawing de l original, on regarde les composants transferes
|
||||
// (evt filtres par <ctx>). Pour cela, on s aide d un ViewSorter
|
||||
// Pour chaque drawing dont au moins un element a ete transfere :
|
||||
// - On passe le Drawing lui-meme, avec ses views, mais pas ses annotations
|
||||
// (c-a-d on le reconstruit)
|
||||
// - On reconnecte les views aux entites (cf Directory Part)
|
||||
|
||||
DeclareAndCast(IGESData_IGESModel,original,ctx.OriginalModel());
|
||||
Standard_Integer nbo = original->NbEntities();
|
||||
TColStd_Array1OfInteger pris(0,nbo); pris.Init(0);
|
||||
|
||||
// Entites a prendre en compte pour la reconstruction
|
||||
// NB : Les drawings deja transferes ne sont bien sur pas reconstruits !
|
||||
Handle(IGESSelect_ViewSorter) sorter = new IGESSelect_ViewSorter;
|
||||
sorter->SetModel(original);
|
||||
sorter->Add(original);
|
||||
for (ctx.Start(); ctx.More(); ctx.Next()) {
|
||||
pris.SetValue (original->Number(ctx.ValueOriginal()),1);
|
||||
}
|
||||
sorter->SortDrawings(ctx.OriginalGraph());
|
||||
Handle(IFSelect_PacketList) sets = sorter->Sets(Standard_True);
|
||||
// Regarder, pour chaque paquet, si au moins un element a ete copie
|
||||
Standard_Integer nbs = sets->NbPackets();
|
||||
for (Standard_Integer is = 1; is <= nbs; is ++) {
|
||||
Interface_EntityIterator setl = sets->Entities(is);
|
||||
Interface_EntityIterator newset;
|
||||
for (setl.Start(); setl.More(); setl.Next()) {
|
||||
Handle(Standard_Transient) newent;
|
||||
if (TC.Search(setl.Value(),newent)) newset.AddItem(newent);
|
||||
}
|
||||
if (newset.NbEntities() == 0) continue;
|
||||
// On en tient un : le transferer (le reconstruire)
|
||||
Handle(IGESData_IGESEntity) item = sorter->SetItem(is,Standard_True);
|
||||
if (item->TypeNumber() != PourDrawing) continue;
|
||||
if (item->IsKind(STANDARD_TYPE(IGESDraw_Drawing))) {
|
||||
DeclareAndCast(IGESDraw_Drawing,draw,item);
|
||||
Standard_Integer nbv = draw->NbViews();
|
||||
Handle(IGESDraw_HArray1OfViewKindEntity) views;
|
||||
if (nbv > 0) views = new IGESDraw_HArray1OfViewKindEntity (1,nbv);
|
||||
// Passer ses vues : toutes
|
||||
// Aussi les positions des vues
|
||||
Handle(TColgp_HArray1OfXY) origs;
|
||||
if (nbv > 0) origs = new TColgp_HArray1OfXY (1,nbv);
|
||||
for (Standard_Integer iv = 1; iv <= nbv; iv ++) {
|
||||
DeclareAndCast(IGESData_ViewKindEntity,aview,
|
||||
TC.Transferred(draw->ViewItem(iv)));
|
||||
views->SetValue(iv,aview);
|
||||
target->AddEntity(aview);
|
||||
origs->SetValue(iv,draw->ViewOrigin(iv).XY());
|
||||
}
|
||||
// Frame : passer ce qui a ete transfere
|
||||
Handle(IGESData_HArray1OfIGESEntity) frame;
|
||||
Standard_Integer nba = draw->NbAnnotations();
|
||||
Interface_EntityIterator framelist;
|
||||
Standard_Integer ia; // svv Jan11 2000 : porting on DEC
|
||||
for (ia = 1; ia <= nba; ia ++) {
|
||||
Handle(Standard_Transient) annot;
|
||||
if (TC.Search(draw->Annotation(ia),annot)) framelist.GetOneItem(annot);
|
||||
}
|
||||
nba = framelist.NbEntities(); ia = 0;
|
||||
if (nba > 0) frame = new IGESData_HArray1OfIGESEntity (1,nba);
|
||||
for (framelist.Start(); framelist.More(); framelist.Next()) {
|
||||
ia ++; frame->SetValue(ia,GetCasted(IGESData_IGESEntity,framelist.Value()));
|
||||
}
|
||||
// Cayest, fabriquer le nouveau Drawing et l ajouter
|
||||
Handle(IGESDraw_Drawing) newdraw = new IGESDraw_Drawing;
|
||||
newdraw->Init (views,origs,frame);
|
||||
// Reste le nom, + autres ? drawing unit, ...
|
||||
|
||||
// Drawing With Rotation : quasiment identique
|
||||
} else if (item->IsKind(STANDARD_TYPE(IGESDraw_DrawingWithRotation))) {
|
||||
DeclareAndCast(IGESDraw_DrawingWithRotation,draw,item);
|
||||
Standard_Integer nbv = draw->NbViews();
|
||||
Handle(IGESDraw_HArray1OfViewKindEntity) views;
|
||||
if (nbv > 0) views = new IGESDraw_HArray1OfViewKindEntity (1,nbv);
|
||||
// Passer ses vues : toutes
|
||||
// Aussi les positions des vues .. et les rotations
|
||||
Handle(TColgp_HArray1OfXY) origs;
|
||||
if (nbv > 0) origs = new TColgp_HArray1OfXY (1,nbv);
|
||||
Handle(TColStd_HArray1OfReal) rots;
|
||||
if (nbv > 0) { rots = new TColStd_HArray1OfReal (1,nbv); rots->Init(0.0); }
|
||||
|
||||
for (Standard_Integer iv = 1; iv <= nbv; iv ++) {
|
||||
DeclareAndCast(IGESData_ViewKindEntity,aview,
|
||||
TC.Transferred(draw->ViewItem(iv)));
|
||||
views->SetValue(iv,aview);
|
||||
target->AddEntity(aview);
|
||||
rots->SetValue(iv,draw->OrientationAngle(iv));
|
||||
origs->SetValue(iv,draw->ViewOrigin(iv).XY());
|
||||
}
|
||||
// Frame : passer ce qui a ete transfere
|
||||
Handle(IGESData_HArray1OfIGESEntity) frame;
|
||||
Standard_Integer nba = draw->NbAnnotations();
|
||||
Interface_EntityIterator framelist;
|
||||
Standard_Integer ia; // svv Jan11 2000 : porting on DEC
|
||||
for (ia = 1; ia <= nba; ia ++) {
|
||||
Handle(Standard_Transient) annot;
|
||||
if (TC.Search(draw->Annotation(ia),annot)) framelist.GetOneItem(annot);
|
||||
}
|
||||
nba = framelist.NbEntities(); ia = 0;
|
||||
if (nba > 0) frame = new IGESData_HArray1OfIGESEntity (1,nba);
|
||||
for (framelist.Start(); framelist.More(); framelist.Next()) {
|
||||
ia ++; frame->SetValue(ia,GetCasted(IGESData_IGESEntity,framelist.Value()));
|
||||
}
|
||||
// Cayest, fabriquer le nouveau DrawingWithRotation et l ajouter
|
||||
Handle(IGESDraw_DrawingWithRotation) newdraw = new IGESDraw_DrawingWithRotation;
|
||||
newdraw->Init (views,origs,rots,frame);
|
||||
// Reste le nom, + autres ? drawing unit, ...
|
||||
}
|
||||
|
||||
// Il faut encore mettre a jour les Views notees en Directory Part
|
||||
// Pour cela, considerer <setl>, pour chaque terme, regarder View()
|
||||
// si View() transfere, mettre a jour ...
|
||||
for (setl.Start(); setl.More(); setl.Next()) {
|
||||
DeclareAndCast(IGESData_IGESEntity,ent,setl.Value());
|
||||
Handle(IGESData_ViewKindEntity) vieworig, viewnew;
|
||||
vieworig = ent->View();
|
||||
if (vieworig.IsNull()) continue;
|
||||
if (!TC.Search(vieworig,viewnew)) continue;
|
||||
ent->InitView(viewnew);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
TCollection_AsciiString IGESSelect_RebuildDrawings::Label () const
|
||||
{ return TCollection_AsciiString("Rebuild Drawings (with empty views)"); }
|
38
src/IGESSelect/IGESSelect_RebuildGroups.cdl
Executable file
38
src/IGESSelect/IGESSelect_RebuildGroups.cdl
Executable file
@@ -0,0 +1,38 @@
|
||||
-- File: IGESSelect_RebuildGroups.cdl
|
||||
-- Created: Wed Jun 1 18:08:58 1994
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@bravox>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
class RebuildGroups from IGESSelect inherits ModelModifier from IGESSelect
|
||||
|
||||
---Purpose : Rebuilds Groups which were bypassed to produce new models.
|
||||
-- If a set of entities, all put into a same IGESModel, were
|
||||
-- part of a same Group in the starting Model, this Modifier
|
||||
-- rebuilds the original group, but only with the transferred
|
||||
-- entities. The distinctions (Ordered or not, "WhithoutBackP"
|
||||
-- or not) are renewed, also the name of the group.
|
||||
--
|
||||
-- If the Input Selection is present, tries to rebuild groups
|
||||
-- only for the selected entities. Else, tries to rebuild
|
||||
-- groups for all the transferred entities.
|
||||
|
||||
uses AsciiString from TCollection,
|
||||
IGESModel, CopyTool, ContextModif
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable RebuildGroups;
|
||||
---Purpose : Creates an RebuildGroups, which uses the system Date
|
||||
|
||||
Performing (me; ctx : in out ContextModif;
|
||||
target : mutable IGESModel;
|
||||
TC : in out CopyTool);
|
||||
---Purpose : Specific action : Rebuilds the original groups
|
||||
|
||||
Label (me) returns AsciiString from TCollection;
|
||||
---Purpose : Returns a text which is
|
||||
-- "Rebuild Groups"
|
||||
|
||||
end RebuildGroups;
|
117
src/IGESSelect/IGESSelect_RebuildGroups.cxx
Executable file
117
src/IGESSelect/IGESSelect_RebuildGroups.cxx
Executable file
@@ -0,0 +1,117 @@
|
||||
#include <IGESSelect_RebuildGroups.ixx>
|
||||
#include <IGESData_IGESEntity.hxx>
|
||||
#include <IGESData_HArray1OfIGESEntity.hxx>
|
||||
#include <IGESBasic_Group.hxx>
|
||||
#include <IGESBasic_GroupWithoutBackP.hxx>
|
||||
#include <IGESBasic_OrderedGroup.hxx>
|
||||
#include <IGESBasic_OrderedGroupWithoutBackP.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
#include <Interface_EntityIterator.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
|
||||
|
||||
|
||||
IGESSelect_RebuildGroups::IGESSelect_RebuildGroups ()
|
||||
: IGESSelect_ModelModifier (Standard_True) { }
|
||||
|
||||
void IGESSelect_RebuildGroups::Performing
|
||||
(IFSelect_ContextModif& ctx,
|
||||
const Handle(IGESData_IGESModel)& target,
|
||||
Interface_CopyTool& TC) const
|
||||
{
|
||||
// On reconstruit les groupes qui peuvent l etre
|
||||
// Pour chaque groupe de l original, on regarde les composants transferes
|
||||
// (evt filtres par <ctx>)
|
||||
// Ensuite, silyena plus d une, on refait un nouveau groupe
|
||||
DeclareAndCast(IGESData_IGESModel,original,ctx.OriginalModel());
|
||||
Standard_Integer nbo = original->NbEntities();
|
||||
|
||||
// Entites a prendre en compte pour la reconstruction
|
||||
// NB : Les groupes deja transferes ne sont bien sur pas reconstruits !
|
||||
TColStd_Array1OfInteger pris(0,nbo); pris.Init(0);
|
||||
for (ctx.Start(); ctx.More(); ctx.Next()) {
|
||||
pris.SetValue (original->Number(ctx.ValueOriginal()),1);
|
||||
}
|
||||
|
||||
for (Standard_Integer i = 1; i <= nbo; i ++) {
|
||||
Handle(IGESData_IGESEntity) ent = original->Entity(i);
|
||||
if (ent->TypeNumber() != 402) continue;
|
||||
Standard_Integer casenum = 0;
|
||||
Handle(Standard_Transient) newent;
|
||||
Interface_EntityIterator newlist;
|
||||
if (TC.Search(ent,newent)) continue; // deja passe
|
||||
if (ent->IsKind(STANDARD_TYPE(IGESBasic_Group))) {
|
||||
DeclareAndCast(IGESBasic_Group,g,ent);
|
||||
casenum = 1;
|
||||
Standard_Integer nbg = g->NbEntities();
|
||||
for (Standard_Integer ig = 1; ig <= nbg; ig ++) {
|
||||
if (TC.Search(g->Value(i),newent)) newlist.GetOneItem(newent);
|
||||
}
|
||||
}
|
||||
if (ent->IsKind(STANDARD_TYPE(IGESBasic_GroupWithoutBackP))) {
|
||||
DeclareAndCast(IGESBasic_GroupWithoutBackP,g,ent);
|
||||
casenum = 2;
|
||||
Standard_Integer nbg = g->NbEntities();
|
||||
for (Standard_Integer ig = 1; ig <= nbg; ig ++) {
|
||||
if (TC.Search(g->Value(i),newent)) newlist.GetOneItem(newent);
|
||||
}
|
||||
}
|
||||
if (ent->IsKind(STANDARD_TYPE(IGESBasic_OrderedGroup))) {
|
||||
DeclareAndCast(IGESBasic_OrderedGroup,g,ent);
|
||||
casenum = 3;
|
||||
Standard_Integer nbg = g->NbEntities();
|
||||
for (Standard_Integer ig = 1; ig <= nbg; ig ++) {
|
||||
if (TC.Search(g->Value(i),newent)) newlist.GetOneItem(newent);
|
||||
}
|
||||
}
|
||||
if (ent->IsKind(STANDARD_TYPE(IGESBasic_OrderedGroupWithoutBackP))) {
|
||||
DeclareAndCast(IGESBasic_OrderedGroupWithoutBackP,g,ent);
|
||||
casenum = 4;
|
||||
Standard_Integer nbg = g->NbEntities();
|
||||
for (Standard_Integer ig = 1; ig <= nbg; ig ++) {
|
||||
if (TC.Search(g->Value(i),newent)) newlist.GetOneItem(newent);
|
||||
}
|
||||
}
|
||||
// A present, reconstruire sil le faut
|
||||
if (newlist.NbEntities() <= 1) continue; // 0 ou 1 : rien a refaire
|
||||
Handle(IGESData_HArray1OfIGESEntity) tab =
|
||||
new IGESData_HArray1OfIGESEntity(1,newlist.NbEntities());
|
||||
Standard_Integer ng = 0;
|
||||
for (newlist.Start(); newlist.More(); newlist.Next()) {
|
||||
ng ++; tab->SetValue(ng,GetCasted(IGESData_IGESEntity,newlist.Value()));
|
||||
}
|
||||
switch (casenum) {
|
||||
case 1 : {
|
||||
Handle(IGESBasic_Group) g = new IGESBasic_Group;
|
||||
g->Init(tab);
|
||||
target->AddEntity(g);
|
||||
|
||||
// Q : faut-il transferer le nom silyena un ?
|
||||
}
|
||||
break;
|
||||
case 2 : {
|
||||
Handle(IGESBasic_GroupWithoutBackP) g = new IGESBasic_GroupWithoutBackP;
|
||||
g->Init(tab);
|
||||
target->AddEntity(g);
|
||||
}
|
||||
break;
|
||||
case 3 : {
|
||||
Handle(IGESBasic_OrderedGroup) g = new IGESBasic_OrderedGroup;
|
||||
g->Init(tab);
|
||||
target->AddEntity(g);
|
||||
}
|
||||
break;
|
||||
case 4 : {
|
||||
Handle(IGESBasic_OrderedGroupWithoutBackP) g =
|
||||
new IGESBasic_OrderedGroupWithoutBackP;
|
||||
g->Init(tab);
|
||||
target->AddEntity(g);
|
||||
}
|
||||
break;
|
||||
default : break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TCollection_AsciiString IGESSelect_RebuildGroups::Label () const
|
||||
{ return TCollection_AsciiString("Rebuild Groups"); }
|
36
src/IGESSelect/IGESSelect_RemoveCurves.cdl
Executable file
36
src/IGESSelect/IGESSelect_RemoveCurves.cdl
Executable file
@@ -0,0 +1,36 @@
|
||||
-- File: IGESSelect_RemoveCurves.cdl
|
||||
-- Created: Wed Feb 24 09:52:46 1999
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@heliox.paris1.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 1999
|
||||
|
||||
|
||||
class RemoveCurves from IGESSelect inherits ModelModifier from IGESSelect
|
||||
|
||||
---Purpose : Removes Curves UV or 3D (not both !) from Faces, those
|
||||
-- designated by the Selection. No Selection means all the file
|
||||
|
||||
uses AsciiString from TCollection,
|
||||
IGESModel, CopyTool, ContextModif
|
||||
|
||||
is
|
||||
|
||||
Create (UV : Boolean) returns mutable RemoveCurves;
|
||||
---Purpose : Creates a RemoveCurves from Faces (141/142/143/144)
|
||||
-- UV True : Removes UV Curves (pcurves)
|
||||
-- UV False : Removes 3D Curves
|
||||
|
||||
Performing (me; ctx : in out ContextModif;
|
||||
target : mutable IGESModel;
|
||||
TC : in out CopyTool);
|
||||
---Purpose : Specific action : Removes the Curves
|
||||
|
||||
Label (me) returns AsciiString from TCollection;
|
||||
---Purpose : Returns a text which is
|
||||
-- "Remove Curves UV on Face" or "Remove Curves 3D on Face"
|
||||
|
||||
fields
|
||||
|
||||
theUV : Boolean;
|
||||
|
||||
end RemoveCurves;
|
114
src/IGESSelect/IGESSelect_RemoveCurves.cxx
Executable file
114
src/IGESSelect/IGESSelect_RemoveCurves.cxx
Executable file
@@ -0,0 +1,114 @@
|
||||
#include <IGESSelect_RemoveCurves.ixx>
|
||||
#include <Interface_Macros.hxx>
|
||||
#include <IGESGeom_TrimmedSurface.hxx>
|
||||
#include <IGESGeom_BoundedSurface.hxx>
|
||||
#include <IGESGeom_CurveOnSurface.hxx>
|
||||
#include <IGESGeom_Boundary.hxx>
|
||||
#include <IGESData_IGESEntity.hxx>
|
||||
#include <IGESData_HArray1OfIGESEntity.hxx>
|
||||
#include <IGESBasic_HArray1OfHArray1OfIGESEntity.hxx>
|
||||
#include <TColStd_HArray1OfInteger.hxx>
|
||||
|
||||
|
||||
|
||||
IGESSelect_RemoveCurves::IGESSelect_RemoveCurves (const Standard_Boolean UV)
|
||||
: IGESSelect_ModelModifier (Standard_True) , theUV (UV) { }
|
||||
|
||||
static Standard_Boolean Edit
|
||||
(const Handle(Standard_Transient)& ent, const Standard_Boolean UV)
|
||||
{
|
||||
Standard_Boolean res = Standard_False;
|
||||
DeclareAndCast(IGESGeom_TrimmedSurface,trsu,ent);
|
||||
if (!trsu.IsNull()) {
|
||||
res = Edit (trsu->OuterContour(),UV);
|
||||
Standard_Integer i,nb = trsu->NbInnerContours();
|
||||
for (i = 1; i <= nb; i ++) {
|
||||
res = res | Edit (trsu->InnerContour(i),UV);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
DeclareAndCast(IGESGeom_BoundedSurface,bnsu,ent);
|
||||
if (!bnsu.IsNull()) {
|
||||
Standard_Integer i,nb = bnsu->NbBoundaries();
|
||||
for (i = 1; i <= nb; i ++) {
|
||||
res = res | Edit (bnsu->Boundary(i),UV);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
DeclareAndCast(IGESGeom_CurveOnSurface,cons,ent);
|
||||
if (!cons.IsNull()) {
|
||||
Handle(IGESData_IGESEntity) cuv,c3d;
|
||||
cuv = cons->CurveUV();
|
||||
c3d = cons->Curve3D();
|
||||
Standard_Integer pref = cons->PreferenceMode();
|
||||
if (UV && !c3d.IsNull()) {
|
||||
if (cuv.IsNull() || c3d.IsNull()) return Standard_False; // rien a faire
|
||||
cuv.Nullify();
|
||||
if (pref == 1) pref = 0;
|
||||
if (pref == 3) pref = 2;
|
||||
} else if (!cuv.IsNull()) {
|
||||
if (cuv.IsNull() || c3d.IsNull()) return Standard_False; // rien a faire
|
||||
c3d.Nullify();
|
||||
if (pref == 2) pref = 0;
|
||||
if (pref == 3) pref = 1;
|
||||
}
|
||||
cons->Init ( cons->CreationMode(), cons->Surface(), cuv, c3d, pref );
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
DeclareAndCast(IGESGeom_Boundary,bndy,ent);
|
||||
if (!bndy.IsNull()) {
|
||||
Standard_Integer i, nb = bndy->NbModelSpaceCurves();
|
||||
if (nb == 0) return Standard_False;
|
||||
Handle(IGESData_HArray1OfIGESEntity) arc3d = new IGESData_HArray1OfIGESEntity(1,nb);
|
||||
Handle(IGESBasic_HArray1OfHArray1OfIGESEntity) arcuv = new IGESBasic_HArray1OfHArray1OfIGESEntity (1,nb);
|
||||
Handle(TColStd_HArray1OfInteger) sens = new TColStd_HArray1OfInteger(1,nb);
|
||||
for (i = 1; i <= nb; i ++) {
|
||||
sens->SetValue (i,bndy->Sense(i));
|
||||
Handle(IGESData_HArray1OfIGESEntity) cuv = bndy->ParameterCurves(i);
|
||||
Handle(IGESData_IGESEntity) c3d = bndy->ModelSpaceCurve (i);
|
||||
if (UV) {
|
||||
if (cuv.IsNull() || c3d.IsNull()) continue; // rien a faire
|
||||
cuv.Nullify();
|
||||
arcuv->SetValue (i,cuv);
|
||||
} else {
|
||||
if (cuv.IsNull() || c3d.IsNull()) continue; // rien a faire
|
||||
c3d.Nullify();
|
||||
arc3d->SetValue (i,c3d);
|
||||
res = Standard_True;
|
||||
}
|
||||
}
|
||||
// Y a-t-il eu de la retouche ?
|
||||
Standard_Integer pref = bndy->PreferenceType();
|
||||
if (UV) {
|
||||
if (pref == 2) pref = 0;
|
||||
if (pref == 3) pref = 1;
|
||||
} else {
|
||||
if (pref == 1) pref = 0;
|
||||
if (pref == 3) pref = 2;
|
||||
}
|
||||
if (res) bndy->Init (bndy->BoundaryType(),pref,bndy->Surface(),arc3d,sens,arcuv);
|
||||
return res;
|
||||
}
|
||||
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
|
||||
void IGESSelect_RemoveCurves::Performing
|
||||
(IFSelect_ContextModif& ctx,
|
||||
const Handle(IGESData_IGESModel)& target,
|
||||
Interface_CopyTool& TC) const
|
||||
{
|
||||
for (ctx.Start(); ctx.More(); ctx.Next()) {
|
||||
if (Edit (ctx.ValueResult(),theUV) ) ctx.Trace ();
|
||||
}
|
||||
}
|
||||
|
||||
TCollection_AsciiString IGESSelect_RemoveCurves::Label () const
|
||||
{
|
||||
if (theUV) return TCollection_AsciiString ("Remove Curves UV on Face");
|
||||
else return TCollection_AsciiString ("Remove Curves 3D on Face");
|
||||
}
|
62
src/IGESSelect/IGESSelect_SelectBasicGeom.cdl
Executable file
62
src/IGESSelect/IGESSelect_SelectBasicGeom.cdl
Executable file
@@ -0,0 +1,62 @@
|
||||
-- File: IGESSelect_SelectBasicGeom.cdl
|
||||
-- Created: Mon Apr 14 11:10:31 1997
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@heliox.paris1.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 1997
|
||||
|
||||
|
||||
class SelectBasicGeom from IGESSelect inherits SelectExplore
|
||||
|
||||
---Purpose : This selection returns the basic geometric elements
|
||||
-- contained in an IGES Entity
|
||||
-- Intended to run a "quick" transfer. I.E. :
|
||||
-- - for a Group, considers its Elements
|
||||
-- - for a Trimmed or Bounded Surface or a Face (BREP),
|
||||
-- considers the 3D curves of each of its loops
|
||||
-- - for a Plane (108), considers its Bounding Curve
|
||||
-- - for a Curve itself, takes it
|
||||
--
|
||||
-- Also, FREE surfaces are taken, because curve 3d is known for
|
||||
-- them. (the ideal should be to have their natural bounds)
|
||||
--
|
||||
-- If <curvesonly> is set, ONLY curves-3d are returned
|
||||
|
||||
uses AsciiString from TCollection, Transient, EntityIterator, Graph,
|
||||
IGESEntity from IGESData
|
||||
|
||||
is
|
||||
|
||||
Create (mode : Integer) returns mutable SelectBasicGeom;
|
||||
---Purpose : Creates a SelectBasicGeom, which allways works recursively
|
||||
-- mode = -1 : Returns Surfaces (without trimming)
|
||||
-- mode = +1 : Returns Curves 3D (free or bound of surface)
|
||||
-- mode = +2 : Returns Basic Curves 3D : as 1 but CompositeCurves
|
||||
-- are returned in detail
|
||||
-- mode = 0 : both
|
||||
|
||||
CurvesOnly (me) returns Boolean;
|
||||
|
||||
Explore (me; level : Integer; ent : Transient; G : Graph;
|
||||
explored : in out EntityIterator)
|
||||
returns Boolean;
|
||||
---Purpose : Explores an entity, to take its contained Curves 3d
|
||||
-- Works recursively
|
||||
|
||||
|
||||
ExploreLabel (me) returns AsciiString from TCollection;
|
||||
---Purpose : Returns a text defining the criterium : "Curves 3d" or
|
||||
-- "Basic Geometry"
|
||||
|
||||
SubCurves (myclass; ent : IGESEntity; explored : in out EntityIterator)
|
||||
returns Boolean;
|
||||
---Purpose : This method can be called from everywhere to get the curves
|
||||
-- as sub-elements of a given curve :
|
||||
-- CompositeCurve : explored lists its subs + returns True
|
||||
-- Any Curve : explored is not filled but returned is True
|
||||
-- Other : returned is False
|
||||
|
||||
fields
|
||||
|
||||
thegeom : Integer; -- -1 : Surfaces only 1 : Curves 3D only 0 : both
|
||||
|
||||
end SelectBasicGeom;
|
200
src/IGESSelect/IGESSelect_SelectBasicGeom.cxx
Executable file
200
src/IGESSelect/IGESSelect_SelectBasicGeom.cxx
Executable file
@@ -0,0 +1,200 @@
|
||||
#include <IGESSelect_SelectBasicGeom.ixx>
|
||||
#include <IGESData_IGESEntity.hxx>
|
||||
#include <IGESGeom_Plane.hxx>
|
||||
#include <IGESGeom_CompositeCurve.hxx>
|
||||
#include <IGESGeom_CurveOnSurface.hxx>
|
||||
#include <IGESGeom_TrimmedSurface.hxx>
|
||||
#include <IGESGeom_BoundedSurface.hxx>
|
||||
#include <IGESGeom_Boundary.hxx>
|
||||
#include <IGESBasic_SingleParent.hxx>
|
||||
#include <IGESBasic_Group.hxx>
|
||||
#include <IGESSolid_ManifoldSolid.hxx>
|
||||
#include <IGESSolid_Shell.hxx>
|
||||
#include <IGESSolid_Face.hxx>
|
||||
#include <IGESSolid_Loop.hxx>
|
||||
#include <IGESSolid_EdgeList.hxx>
|
||||
|
||||
#include <Interface_Macros.hxx>
|
||||
|
||||
|
||||
|
||||
IGESSelect_SelectBasicGeom::IGESSelect_SelectBasicGeom
|
||||
(const Standard_Integer mode)
|
||||
: IFSelect_SelectExplore (-1) { thegeom = mode; }
|
||||
|
||||
Standard_Boolean IGESSelect_SelectBasicGeom::Explore
|
||||
(const Standard_Integer level, const Handle(Standard_Transient)& ent,
|
||||
const Interface_Graph& G, Interface_EntityIterator& explored) const
|
||||
{
|
||||
// thegeom > 0 : curves3d < 0 : surfaces == 0 : curves3d + surfaces libres
|
||||
|
||||
DeclareAndCast(IGESData_IGESEntity,igesent,ent);
|
||||
if (igesent.IsNull()) return Standard_False;
|
||||
Standard_Integer igt = igesent->TypeNumber();
|
||||
|
||||
// CompositeCurve : a decomposer ?
|
||||
if (igt == 102 && thegeom == 2) {
|
||||
DeclareAndCast(IGESGeom_CompositeCurve,cmc,ent);
|
||||
Standard_Integer i, nb = cmc->NbCurves();
|
||||
for (i = 1; i <= nb; i ++) explored.AddItem (cmc->Curve(i));
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
// Lignes en general. Attention CopiousData, aux variantes "habillage"
|
||||
if (igt == 106) return (igesent->FormNumber() < 20);
|
||||
if ( (igt >= 100 && igt <= 106) || igt == 110 || igt == 112 || igt == 116 ||
|
||||
igt == 126 || igt == 130) return (thegeom >= 0);
|
||||
|
||||
// Surfaces LIBRES, car il n y a pas d autre moyen de les reperer
|
||||
// (l ideal serait de prendre les bords naturels)
|
||||
// Ou surfaces debarassees de leurs contours
|
||||
if (igt == 114 || igt == 118 || igt == 120 || igt == 122 || igt == 128 || igt == 140 || igt == 190)
|
||||
return (thegeom <= 0);
|
||||
|
||||
// Plan 108
|
||||
// mode surface : on retourne tout le Plane sinon c est inexploitable
|
||||
if (igt == 108) {
|
||||
DeclareAndCast(IGESGeom_Plane,pln,ent);
|
||||
if (thegeom >= 0) explored.AddItem(pln->BoundingCurve());
|
||||
return pln->HasBoundingCurve();
|
||||
}
|
||||
|
||||
if (igt == 116) return (thegeom >= 0); // on point, ca va bien ...
|
||||
|
||||
// TrimmedSurface 144
|
||||
if (igt == 144) {
|
||||
DeclareAndCast(IGESGeom_TrimmedSurface,trs,ent);
|
||||
if (thegeom >= 0) {
|
||||
explored.AddItem(trs->OuterContour());
|
||||
Standard_Integer i, nb = trs->NbInnerContours();
|
||||
for (i = 1; i <= nb; i ++) explored.AddItem (trs->InnerContour(i));
|
||||
}
|
||||
else explored.AddItem (trs->Surface());
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
// CurveOnSurface 142
|
||||
if (igt == 142 && thegeom >= 0) {
|
||||
DeclareAndCast(IGESGeom_CurveOnSurface,crf,ent);
|
||||
explored.AddItem(crf->Curve3D());
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
// Boundary 141
|
||||
if (igt == 141 && thegeom >= 0) {
|
||||
DeclareAndCast(IGESGeom_Boundary,bnd,ent);
|
||||
Standard_Integer i, nb = bnd->NbModelSpaceCurves();
|
||||
for (i = 1; i <= nb; i ++) explored.AddItem (bnd->ModelSpaceCurve(i));
|
||||
return (nb > 0);
|
||||
}
|
||||
|
||||
// BoundedSurface 143
|
||||
if (igt == 143) {
|
||||
DeclareAndCast(IGESGeom_BoundedSurface,bns,ent);
|
||||
Standard_Integer i, nb = 0;
|
||||
if (thegeom >= 0) {
|
||||
nb = bns->NbBoundaries();
|
||||
for (i = 1; i <= nb; i ++) explored.AddItem (bns->Boundary(i));
|
||||
return (nb != 0);
|
||||
}
|
||||
else explored.AddItem (bns->Surface());
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
// SingleParent
|
||||
if (igt == 402 && igesent->FormNumber() == 9) {
|
||||
DeclareAndCast(IGESBasic_SingleParent,sp,ent);
|
||||
if (sp.IsNull()) return Standard_False;
|
||||
explored.AddItem (sp->SingleParent());
|
||||
Standard_Integer i,nb = sp->NbChildren();
|
||||
for (i = 1; i <= nb; i ++) explored.AddItem (sp->Child(i));
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
// Groups ... en dernier de la serie 402
|
||||
if (igt == 402) {
|
||||
DeclareAndCast(IGESBasic_Group,gr,ent);
|
||||
if (gr.IsNull()) return Standard_False;
|
||||
Standard_Integer i, nb = gr->NbEntities();
|
||||
for (i = 1; i <= nb; i ++) explored.AddItem (gr->Entity(i));
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
// ManifoldSolid 186 -> Shells
|
||||
if (igt == 186) {
|
||||
DeclareAndCast(IGESSolid_ManifoldSolid,msb,ent);
|
||||
explored.AddItem (msb->Shell());
|
||||
Standard_Integer i, nb = msb->NbVoidShells();
|
||||
for (i = 1; i <= nb; i ++) explored.AddItem (msb->VoidShell(i));
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
// Shell 514 -> Faces
|
||||
if (igt == 514) {
|
||||
DeclareAndCast(IGESSolid_Shell,sh,ent);
|
||||
Standard_Integer i, nb = sh->NbFaces();
|
||||
for (i = 1; i <= nb; i ++) explored.AddItem (sh->Face(i));
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
// Face 510 -> Loops
|
||||
if (igt == 510) {
|
||||
DeclareAndCast(IGESSolid_Face,fc,ent);
|
||||
if (thegeom >= 0) {
|
||||
Standard_Integer i, nb = fc->NbLoops();
|
||||
for (i = 1; i <= nb; i ++) explored.AddItem (fc->Loop(i));
|
||||
}
|
||||
else explored.AddItem (fc->Surface());
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
// Loop 508 -> Curves 3D (enfin !) mais via EdgeList ...
|
||||
if (igt == 508 && thegeom >= 0) {
|
||||
DeclareAndCast(IGESSolid_Loop,lp,ent);
|
||||
Standard_Integer i, nb = lp->NbEdges();
|
||||
for (i = 1; i <= nb; i ++) {
|
||||
DeclareAndCast(IGESSolid_EdgeList,edl,lp->Edge(i));
|
||||
Standard_Integer ind = lp->ListIndex(i);
|
||||
if (edl.IsNull()) continue;
|
||||
explored.AddItem(edl->Curve(ind));
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
// Pas trouve
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
|
||||
TCollection_AsciiString IGESSelect_SelectBasicGeom::ExploreLabel () const
|
||||
{
|
||||
if (thegeom == 2) return TCollection_AsciiString ("Basic Curves 3d");
|
||||
else if (thegeom > 0) return TCollection_AsciiString ("Curves 3d");
|
||||
else if (thegeom < 0) return TCollection_AsciiString ("Surfaces");
|
||||
else return TCollection_AsciiString ("Basic Geometry");
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean IGESSelect_SelectBasicGeom::SubCurves
|
||||
(const Handle(IGESData_IGESEntity)& ent,
|
||||
Interface_EntityIterator& explored)
|
||||
{
|
||||
if (ent.IsNull()) return Standard_False;
|
||||
Standard_Integer igt = ent->TypeNumber();
|
||||
|
||||
// CompositeCurve : a decomposer ?
|
||||
if (igt == 102) {
|
||||
DeclareAndCast(IGESGeom_CompositeCurve,cmc,ent);
|
||||
Standard_Integer i, nb = cmc->NbCurves();
|
||||
for (i = 1; i <= nb; i ++) explored.AddItem (cmc->Curve(i));
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
// Lignes en general. Attention CopiousData, aux variantes "habillage"
|
||||
if (igt == 106) return (ent->FormNumber() < 20);
|
||||
if ( (igt >= 100 && igt <= 106) || igt == 110 || igt == 112 || igt == 116 ||
|
||||
igt == 126 || igt == 130) return Standard_True;
|
||||
|
||||
// Sinon
|
||||
return Standard_False;
|
||||
}
|
39
src/IGESSelect/IGESSelect_SelectBypassGroup.cdl
Executable file
39
src/IGESSelect/IGESSelect_SelectBypassGroup.cdl
Executable file
@@ -0,0 +1,39 @@
|
||||
-- File: IGESSelect_SelectBypassGroup.cdl
|
||||
-- Created: Wed Jun 1 15:57:53 1994
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@bravox>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
class SelectBypassGroup from IGESSelect inherits SelectExplore
|
||||
|
||||
---Purpose : Selects a list built as follows :
|
||||
-- Groups are entities type 402, forms 1,7,14,15 (Group,
|
||||
-- Ordered or not, "WithoutBackPointer" or not)
|
||||
--
|
||||
-- Entities which are not GROUP are taken as such
|
||||
-- For Groups, their list of Elements is explore
|
||||
-- Hence, level 0 (D) recursively explores a Group if some of
|
||||
-- its Elements are Groups. level 1 explores just at first level
|
||||
|
||||
uses AsciiString from TCollection, Transient, EntityIterator, Graph
|
||||
|
||||
raises InterfaceError
|
||||
|
||||
is
|
||||
|
||||
Create (level : Integer = 0) returns mutable SelectBypassGroup;
|
||||
---Purpose : Creates a SelectBypassGroup, by default all level
|
||||
-- (level = 1 explores at first level)
|
||||
|
||||
Explore (me; level : Integer; ent : Transient; G : Graph;
|
||||
explored : in out EntityIterator)
|
||||
returns Boolean;
|
||||
---Purpose : Explores an entity : for a Group, gives its elements
|
||||
-- Else, takes the entity itself
|
||||
|
||||
|
||||
ExploreLabel (me) returns AsciiString from TCollection;
|
||||
---Purpose : Returns a text defining the criterium : "Content of Group"
|
||||
|
||||
end SelectBypassGroup;
|
32
src/IGESSelect/IGESSelect_SelectBypassGroup.cxx
Executable file
32
src/IGESSelect/IGESSelect_SelectBypassGroup.cxx
Executable file
@@ -0,0 +1,32 @@
|
||||
#include <IGESSelect_SelectBypassGroup.ixx>
|
||||
#include <IGESData_IGESEntity.hxx>
|
||||
#include <IGESBasic_Group.hxx>
|
||||
#include <IGESBasic_GroupWithoutBackP.hxx>
|
||||
#include <IGESBasic_OrderedGroup.hxx>
|
||||
#include <IGESBasic_OrderedGroupWithoutBackP.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
|
||||
|
||||
#define TypePourGroup 402
|
||||
|
||||
|
||||
IGESSelect_SelectBypassGroup::IGESSelect_SelectBypassGroup
|
||||
(const Standard_Integer level)
|
||||
: IFSelect_SelectExplore (level) { }
|
||||
|
||||
|
||||
Standard_Boolean IGESSelect_SelectBypassGroup::Explore
|
||||
(const Standard_Integer level, const Handle(Standard_Transient)& ent,
|
||||
const Interface_Graph& G, Interface_EntityIterator& explored) const
|
||||
{
|
||||
DeclareAndCast(IGESBasic_Group,gr,ent); // Group les regroupe tous
|
||||
if (gr.IsNull()) return Standard_True;
|
||||
|
||||
Standard_Integer i, nb = gr->NbEntities();
|
||||
for (i = 1; i <= nb; i ++) explored.AddItem (gr->Entity(i));
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
TCollection_AsciiString IGESSelect_SelectBypassGroup::ExploreLabel () const
|
||||
{ return TCollection_AsciiString ("Content of Groups"); }
|
45
src/IGESSelect/IGESSelect_SelectBypassSubfigure.cdl
Executable file
45
src/IGESSelect/IGESSelect_SelectBypassSubfigure.cdl
Executable file
@@ -0,0 +1,45 @@
|
||||
-- File: IGESSelect_SelectBypassSubfigure.cdl
|
||||
-- Created: Tue Jan 13 08:44:11 1998
|
||||
-- Author: Christian CAILLET
|
||||
-- <xstep@heliox.paris1.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 1998
|
||||
|
||||
|
||||
class SelectBypassSubfigure from IGESSelect inherits SelectExplore
|
||||
|
||||
---Purpose : Selects a list built as follows :
|
||||
-- Subfigures correspond to
|
||||
-- * Definition (basic : type 308, or Network : type 320)
|
||||
-- * Instance (Singular : type 408, or Network : 420, or
|
||||
-- patterns : 412,414)
|
||||
--
|
||||
-- Entities which are not Subfigure are taken as such
|
||||
-- For Subfigures Instances, their definition is taken, then
|
||||
-- explored itself
|
||||
-- For Subfigures Definitions, the list of "Associated Entities"
|
||||
-- is explored
|
||||
-- Hence, level 0 (D) recursively explores a Subfigure if some of
|
||||
-- its Elements are Subfigures. level 1 explores just at first
|
||||
-- level (i.e. for an instance, returns its definition)
|
||||
|
||||
uses AsciiString from TCollection, Transient, EntityIterator, Graph
|
||||
|
||||
raises InterfaceError
|
||||
|
||||
is
|
||||
|
||||
Create (level : Integer = 0) returns mutable SelectBypassSubfigure;
|
||||
---Purpose : Creates a SelectBypassSubfigure, by default all level
|
||||
-- (level = 1 explores at first level)
|
||||
|
||||
Explore (me; level : Integer; ent : Transient; G : Graph;
|
||||
explored : in out EntityIterator)
|
||||
returns Boolean;
|
||||
---Purpose : Explores an entity : for a Subfigure, gives its elements
|
||||
-- Else, takes the entity itself
|
||||
|
||||
|
||||
ExploreLabel (me) returns AsciiString from TCollection;
|
||||
---Purpose : Returns a text defining the criterium : "Content of Subfigure"
|
||||
|
||||
end SelectBypassSubfigure;
|
69
src/IGESSelect/IGESSelect_SelectBypassSubfigure.cxx
Executable file
69
src/IGESSelect/IGESSelect_SelectBypassSubfigure.cxx
Executable file
@@ -0,0 +1,69 @@
|
||||
#include <IGESSelect_SelectBypassSubfigure.ixx>
|
||||
#include <IGESData_IGESEntity.hxx>
|
||||
#include <IGESBasic_SubfigureDef.hxx>
|
||||
#include <IGESBasic_SingularSubfigure.hxx>
|
||||
#include <IGESDraw_NetworkSubfigureDef.hxx>
|
||||
#include <IGESDraw_NetworkSubfigure.hxx>
|
||||
#include <IGESDraw_RectArraySubfigure.hxx>
|
||||
#include <IGESDraw_CircArraySubfigure.hxx>
|
||||
|
||||
#include <Interface_Macros.hxx>
|
||||
|
||||
|
||||
|
||||
IGESSelect_SelectBypassSubfigure::IGESSelect_SelectBypassSubfigure
|
||||
(const Standard_Integer level)
|
||||
: IFSelect_SelectExplore (level) { }
|
||||
|
||||
|
||||
Standard_Boolean IGESSelect_SelectBypassSubfigure::Explore
|
||||
(const Standard_Integer level, const Handle(Standard_Transient)& ent,
|
||||
const Interface_Graph& G, Interface_EntityIterator& explored) const
|
||||
{
|
||||
DeclareAndCast(IGESData_IGESEntity,igesent,ent);
|
||||
if (igesent.IsNull()) return Standard_False;
|
||||
Standard_Integer igt = igesent->TypeNumber();
|
||||
|
||||
// SingularSubfigure
|
||||
if (igt == 308) {
|
||||
DeclareAndCast(IGESBasic_SubfigureDef,subf,ent);
|
||||
if (subf.IsNull()) return Standard_True;
|
||||
Standard_Integer i,nb = subf->NbEntities();
|
||||
for (i = 1; i <= nb; i ++) explored.AddItem (subf->AssociatedEntity(i));
|
||||
return Standard_True;
|
||||
}
|
||||
if (igt == 408) {
|
||||
DeclareAndCast(IGESBasic_SingularSubfigure,subf,ent);
|
||||
explored.AddItem (subf->Subfigure());
|
||||
}
|
||||
|
||||
// NetworkSubfigure
|
||||
if (igt == 320) {
|
||||
DeclareAndCast(IGESDraw_NetworkSubfigureDef,subf,ent);
|
||||
if (subf.IsNull()) return Standard_True;
|
||||
Standard_Integer i,nb = subf->NbEntities();
|
||||
for (i = 1; i <= nb; i ++) explored.AddItem (subf->Entity(i));
|
||||
return Standard_True;
|
||||
}
|
||||
if (igt == 420) {
|
||||
DeclareAndCast(IGESDraw_NetworkSubfigure,subf,ent);
|
||||
explored.AddItem (subf->SubfigureDefinition());
|
||||
}
|
||||
|
||||
// (Pattern)Subfigure
|
||||
if (igt == 412) {
|
||||
DeclareAndCast(IGESDraw_RectArraySubfigure,subf,ent);
|
||||
explored.AddItem (subf->BaseEntity());
|
||||
}
|
||||
if (igt == 414) {
|
||||
DeclareAndCast(IGESDraw_CircArraySubfigure,subf,ent);
|
||||
explored.AddItem (subf->BaseEntity());
|
||||
}
|
||||
|
||||
// Si c est pas tout ca, c est un objet de base et on le prend tel quel
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
TCollection_AsciiString IGESSelect_SelectBypassSubfigure::ExploreLabel () const
|
||||
{ return TCollection_AsciiString ("Content of Subfigures"); }
|
35
src/IGESSelect/IGESSelect_SelectDrawingFrom.cdl
Executable file
35
src/IGESSelect/IGESSelect_SelectDrawingFrom.cdl
Executable file
@@ -0,0 +1,35 @@
|
||||
-- File: IGESSelect_SelectDrawingFrom.cdl
|
||||
-- Created: Wed Jun 1 15:53:27 1994
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@bravox>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
class SelectDrawingFrom from IGESSelect inherits SelectDeduct
|
||||
|
||||
---Purpose : This selection gets the Drawings attached to its input IGES
|
||||
-- entities. They are read through thr Single Views, referenced
|
||||
-- in Directory Parts of the entities
|
||||
|
||||
uses AsciiString from TCollection, EntityIterator, Graph
|
||||
|
||||
raises InterfaceError
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable SelectDrawingFrom;
|
||||
---Purpose : Creates a SelectDrawingFrom
|
||||
|
||||
HasUniqueResult (me) returns Boolean is redefined protected;
|
||||
---Purpose : Returns True, because selection works with a ViewSorter which
|
||||
-- gives a unique result
|
||||
|
||||
RootResult (me; G : Graph) returns EntityIterator raises InterfaceError;
|
||||
---Purpose : Selects the Drawings attached (through Single Views in
|
||||
-- Directory Part) to input entities
|
||||
|
||||
Label (me) returns AsciiString from TCollection;
|
||||
---Purpose : Returns the label, with is "Drawings attached"
|
||||
|
||||
end SelectDrawingFrom;
|
||||
|
30
src/IGESSelect/IGESSelect_SelectDrawingFrom.cxx
Executable file
30
src/IGESSelect/IGESSelect_SelectDrawingFrom.cxx
Executable file
@@ -0,0 +1,30 @@
|
||||
#include <IGESSelect_SelectDrawingFrom.ixx>
|
||||
#include <IGESSelect_ViewSorter.hxx>
|
||||
#include <IGESData_IGESModel.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
|
||||
|
||||
|
||||
IGESSelect_SelectDrawingFrom::IGESSelect_SelectDrawingFrom () { }
|
||||
|
||||
|
||||
Standard_Boolean IGESSelect_SelectDrawingFrom::HasUniqueResult () const
|
||||
{ return Standard_True; }
|
||||
|
||||
Interface_EntityIterator IGESSelect_SelectDrawingFrom::RootResult
|
||||
(const Interface_Graph& G) const
|
||||
{
|
||||
Handle(IGESSelect_ViewSorter) sorter = new IGESSelect_ViewSorter;
|
||||
sorter->SetModel (GetCasted(IGESData_IGESModel,G.Model()));
|
||||
sorter->Clear();
|
||||
sorter->AddList (InputResult(G).Content());
|
||||
sorter->SortDrawings(G);
|
||||
Interface_EntityIterator list;
|
||||
Standard_Integer nb = sorter->NbSets(Standard_True);
|
||||
for (Standard_Integer i = 1; i <= nb; i ++)
|
||||
list.GetOneItem(sorter->SetItem(i,Standard_True));
|
||||
return list;
|
||||
}
|
||||
|
||||
TCollection_AsciiString IGESSelect_SelectDrawingFrom::Label () const
|
||||
{ return TCollection_AsciiString ("Drawings attached"); }
|
39
src/IGESSelect/IGESSelect_SelectFaces.cdl
Executable file
39
src/IGESSelect/IGESSelect_SelectFaces.cdl
Executable file
@@ -0,0 +1,39 @@
|
||||
-- File: IGESSelect_SelectFaces.cdl
|
||||
-- Created: Wed Oct 1 17:39:46 1997
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@heliox.paris1.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 1997
|
||||
|
||||
|
||||
class SelectFaces from IGESSelect inherits SelectExplore
|
||||
|
||||
---Purpose : This selection returns the faces contained in an IGES Entity
|
||||
-- or itself if it is a Face
|
||||
-- Face means :
|
||||
-- - Face (510) of a ManifoldSolidBrep
|
||||
-- - TrimmedSurface (144)
|
||||
-- - BoundedSurface (143)
|
||||
-- - Plane with a Bounding Curve (108, form not 0)
|
||||
-- - Also, any Surface which is not in a TrimmedSurface, a
|
||||
-- BoundedSurface, or a Face (FREE Surface)
|
||||
-- -> i.e. a Face for which Natural Bounds will be considered
|
||||
|
||||
uses AsciiString from TCollection, Transient, EntityIterator, Graph
|
||||
|
||||
is
|
||||
|
||||
|
||||
Create returns mutable SelectFaces;
|
||||
|
||||
|
||||
Explore (me; level : Integer; ent : Transient; G : Graph;
|
||||
explored : in out EntityIterator)
|
||||
returns Boolean;
|
||||
---Purpose : Explores an entity, to take its faces
|
||||
-- Works recursively
|
||||
|
||||
|
||||
ExploreLabel (me) returns AsciiString from TCollection;
|
||||
---Purpose : Returns a text defining the criterium : "Faces"
|
||||
|
||||
end SelectFaces;
|
81
src/IGESSelect/IGESSelect_SelectFaces.cxx
Executable file
81
src/IGESSelect/IGESSelect_SelectFaces.cxx
Executable file
@@ -0,0 +1,81 @@
|
||||
#include <IGESSelect_SelectFaces.ixx>
|
||||
#include <IGESData_IGESEntity.hxx>
|
||||
#include <IGESGeom_Plane.hxx>
|
||||
#include <IGESBasic_SingleParent.hxx>
|
||||
#include <IGESBasic_Group.hxx>
|
||||
#include <IGESSolid_ManifoldSolid.hxx>
|
||||
#include <IGESSolid_Shell.hxx>
|
||||
|
||||
#include <Interface_Macros.hxx>
|
||||
|
||||
|
||||
IGESSelect_SelectFaces::IGESSelect_SelectFaces ()
|
||||
: IFSelect_SelectExplore (-1) { }
|
||||
|
||||
|
||||
Standard_Boolean IGESSelect_SelectFaces::Explore
|
||||
(const Standard_Integer level, const Handle(Standard_Transient)& ent,
|
||||
const Interface_Graph& G, Interface_EntityIterator& explored) const
|
||||
{
|
||||
DeclareAndCast(IGESData_IGESEntity,igesent,ent);
|
||||
if (igesent.IsNull()) return Standard_False;
|
||||
Standard_Integer igt = igesent->TypeNumber();
|
||||
|
||||
// Cas clairs et nets : Faces typees comme telles
|
||||
|
||||
if (igt == 510 || igt == 144 || igt == 143) return Standard_True;
|
||||
|
||||
// Surfaces Libres
|
||||
if (igt == 114 || igt == 118 || igt == 120 || igt == 122 || igt == 128 || igt == 140)
|
||||
return Standard_True;
|
||||
|
||||
// Cas du Plane
|
||||
if (igt == 108) {
|
||||
DeclareAndCast(IGESGeom_Plane,pln,ent);
|
||||
return pln->HasBoundingCurve();
|
||||
}
|
||||
|
||||
// A present, contenants possibles
|
||||
|
||||
// SingleParent
|
||||
if (igt == 402 && igesent->FormNumber() == 9) {
|
||||
DeclareAndCast(IGESBasic_SingleParent,sp,ent);
|
||||
if (sp.IsNull()) return Standard_False;
|
||||
explored.AddItem (sp->SingleParent());
|
||||
Standard_Integer i,nb = sp->NbChildren();
|
||||
for (i = 1; i <= nb; i ++) explored.AddItem (sp->Child(i));
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
// Groups ... en dernier de la serie 402
|
||||
if (igt == 402) {
|
||||
DeclareAndCast(IGESBasic_Group,gr,ent);
|
||||
if (gr.IsNull()) return Standard_False;
|
||||
Standard_Integer i, nb = gr->NbEntities();
|
||||
for (i = 1; i <= nb; i ++) explored.AddItem (gr->Entity(i));
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
// ManifoldSolid 186 -> Shells
|
||||
if (igt == 186) {
|
||||
DeclareAndCast(IGESSolid_ManifoldSolid,msb,ent);
|
||||
explored.AddItem (msb->Shell());
|
||||
Standard_Integer i, nb = msb->NbVoidShells();
|
||||
for (i = 1; i <= nb; i ++) explored.AddItem (msb->VoidShell(i));
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
// Shell 514 -> Faces
|
||||
if (igt == 514) {
|
||||
DeclareAndCast(IGESSolid_Shell,sh,ent);
|
||||
Standard_Integer i, nb = sh->NbFaces();
|
||||
for (i = 1; i <= nb; i ++) explored.AddItem (sh->Face(i));
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
// Pas trouve
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
TCollection_AsciiString IGESSelect_SelectFaces::ExploreLabel () const
|
||||
{ return TCollection_AsciiString ("Faces"); }
|
31
src/IGESSelect/IGESSelect_SelectFromDrawing.cdl
Executable file
31
src/IGESSelect/IGESSelect_SelectFromDrawing.cdl
Executable file
@@ -0,0 +1,31 @@
|
||||
-- File: IGESSelect_SelectFromDrawing.cdl
|
||||
-- Created: Wed Jun 1 15:42:30 1994
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@bravox>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
class SelectFromDrawing from IGESSelect inherits SelectDeduct
|
||||
|
||||
---Purpose : This selection gets in all the model, the entities which are
|
||||
-- attached to the drawing(s) given as input. This includes :
|
||||
-- - Drawing Frame (Annotations directky referenced by Drawings)
|
||||
-- - Entities attached to the single Views referenced by Drawings
|
||||
|
||||
uses AsciiString from TCollection, EntityIterator, Graph
|
||||
|
||||
raises InterfaceError
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable SelectFromDrawing;
|
||||
---Purpose : Creates a SelectFromDrawing
|
||||
|
||||
RootResult (me; G : Graph) returns EntityIterator raises InterfaceError;
|
||||
---Purpose : Selects the Entities which are attached to the Drawing(s)
|
||||
-- present in the Input
|
||||
|
||||
Label (me) returns AsciiString from TCollection;
|
||||
---Purpose : Returns the label, with is "Entities attached to Drawing"
|
||||
|
||||
end SelectFromDrawing;
|
50
src/IGESSelect/IGESSelect_SelectFromDrawing.cxx
Executable file
50
src/IGESSelect/IGESSelect_SelectFromDrawing.cxx
Executable file
@@ -0,0 +1,50 @@
|
||||
#include <IGESSelect_SelectFromDrawing.ixx>
|
||||
#include <IGESData_IGESEntity.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
|
||||
#define PourDrawing 404
|
||||
|
||||
|
||||
IGESSelect_SelectFromDrawing::IGESSelect_SelectFromDrawing () { }
|
||||
|
||||
|
||||
Interface_EntityIterator IGESSelect_SelectFromDrawing::RootResult
|
||||
(const Interface_Graph& G) const
|
||||
{
|
||||
Interface_EntityIterator list, views;
|
||||
Interface_EntityIterator draws = InputResult(G);
|
||||
if (draws.NbEntities() == 0) return list;
|
||||
Standard_Integer nb = G.Size();
|
||||
char* nums = new char[nb+1];
|
||||
Standard_Integer i; // svv Jan11 2000 : porting on DEC
|
||||
for (i = 1; i <= nb; i ++) nums[i] = 0;
|
||||
|
||||
// Pour chaque Drawing : prendre d une part l integralite de son contenu,
|
||||
// (c-a-d avec le "Frame"), d autre part les entites attachees a ses vues
|
||||
for (draws.Start(); draws.More(); draws.Next()) {
|
||||
DeclareAndCast(IGESData_IGESEntity,igesent,draws.Value());
|
||||
if (igesent.IsNull()) continue;
|
||||
if (igesent->TypeNumber() != PourDrawing) continue;
|
||||
list.GetOneItem (igesent);
|
||||
Interface_EntityIterator someviews = G.Shareds (draws.Value());
|
||||
list.AddList (someviews.Content());
|
||||
for (someviews.Start(); someviews.More(); someviews.Next()) {
|
||||
DeclareAndCast(IGESData_ViewKindEntity,igesview,someviews.Value());
|
||||
Standard_Integer nv = G.EntityNumber(igesview);
|
||||
if (nv > 0 && nv <= nb) nums[nv] = 1;
|
||||
}
|
||||
}
|
||||
for (i = 1; i <= nb; i ++) {
|
||||
// if (!G.IsPresent(i)) continue;
|
||||
DeclareAndCast(IGESData_IGESEntity,igesent,G.Entity(i));
|
||||
if (igesent.IsNull()) continue;
|
||||
Standard_Integer nv = G.EntityNumber (igesent->View());
|
||||
if (nv > 0 && nv <= nb) list.GetOneItem(igesent);
|
||||
}
|
||||
delete nums;
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
TCollection_AsciiString IGESSelect_SelectFromDrawing::Label () const
|
||||
{ return TCollection_AsciiString ("Entities attached to a Drawing"); }
|
31
src/IGESSelect/IGESSelect_SelectFromSingleView.cdl
Executable file
31
src/IGESSelect/IGESSelect_SelectFromSingleView.cdl
Executable file
@@ -0,0 +1,31 @@
|
||||
-- File: IGESSelect_SelectFromSingleView.cdl
|
||||
-- Created: Tue May 31 18:36:13 1994
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@bravox>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
class SelectFromSingleView from IGESSelect inherits SelectDeduct
|
||||
|
||||
---Purpose : This selection gets in all the model, the entities which are
|
||||
-- attached to the views given as input. Only Single Views are
|
||||
-- considered. This information is kept from Directory Part
|
||||
-- (View Item).
|
||||
|
||||
uses AsciiString from TCollection, EntityIterator, Graph
|
||||
|
||||
raises InterfaceError
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable SelectFromSingleView;
|
||||
---Purpose : Creates a SelectFromSingleView
|
||||
|
||||
RootResult (me; G : Graph) returns EntityIterator raises InterfaceError;
|
||||
---Purpose : Selects the Entities which are attached to the Single View(s)
|
||||
-- present in the Input
|
||||
|
||||
Label (me) returns AsciiString from TCollection;
|
||||
---Purpose : Returns the label, with is "Entities attached to single View"
|
||||
|
||||
end SelectFromSingleView;
|
37
src/IGESSelect/IGESSelect_SelectFromSingleView.cxx
Executable file
37
src/IGESSelect/IGESSelect_SelectFromSingleView.cxx
Executable file
@@ -0,0 +1,37 @@
|
||||
#include <IGESSelect_SelectFromSingleView.ixx>
|
||||
#include <IGESData_IGESEntity.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
|
||||
|
||||
|
||||
IGESSelect_SelectFromSingleView::IGESSelect_SelectFromSingleView () { }
|
||||
|
||||
|
||||
Interface_EntityIterator IGESSelect_SelectFromSingleView::RootResult
|
||||
(const Interface_Graph& G) const
|
||||
{
|
||||
Interface_EntityIterator list;
|
||||
Interface_EntityIterator views = InputResult(G);
|
||||
if (views.NbEntities() == 0) return list;
|
||||
Standard_Integer nb = G.Size();
|
||||
char* nums = new char[nb+1];
|
||||
Standard_Integer i; // svv Jan11 2000 : porting on DEC
|
||||
for (i = 1; i <= nb; i ++) nums[i] = 0;
|
||||
for (views.Start(); views.More(); views.Next()) {
|
||||
Standard_Integer nv = G.EntityNumber(views.Value());
|
||||
if (nv > 0 && nv <= nb) nums[nv] = 1;
|
||||
}
|
||||
for (i = 1; i <= nb; i ++) {
|
||||
// if (!G.IsPresent(i)) continue;
|
||||
DeclareAndCast(IGESData_IGESEntity,igesent,G.Entity(i));
|
||||
if (igesent.IsNull()) continue;
|
||||
Standard_Integer nv = G.EntityNumber (igesent->View());
|
||||
if (nv > 0 && nv <= nb) list.GetOneItem(igesent);
|
||||
}
|
||||
delete nums;
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
TCollection_AsciiString IGESSelect_SelectFromSingleView::Label () const
|
||||
{ return TCollection_AsciiString ("Entities attached to a single View"); }
|
49
src/IGESSelect/IGESSelect_SelectLevelNumber.cdl
Executable file
49
src/IGESSelect/IGESSelect_SelectLevelNumber.cdl
Executable file
@@ -0,0 +1,49 @@
|
||||
-- File: IGESSelect_SelectLevelNumber.cdl
|
||||
-- Created: Tue May 31 17:57:12 1994
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@bravox>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
class SelectLevelNumber from IGESSelect inherits SelectExtract
|
||||
|
||||
---Purpose : This selection looks at Level Number of IGES Entities :
|
||||
-- it considers items attached, either to a single level with a
|
||||
-- given value, or to a level list which contains this value
|
||||
--
|
||||
-- Level = 0 means entities not attached to any level
|
||||
--
|
||||
-- Remark : the class CounterOfLevelNumber gives informations
|
||||
-- about present levels in a file.
|
||||
|
||||
uses AsciiString from TCollection, Transient, InterfaceModel, IntParam
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable SelectLevelNumber;
|
||||
---Purpose : Creates a SelectLevelNumber, with no Level criterium : see
|
||||
-- SetLevelNumber. Empty, this selection filters nothing.
|
||||
|
||||
SetLevelNumber (me : mutable; levnum : mutable IntParam);
|
||||
---Purpose : Sets a Parameter as Level criterium
|
||||
|
||||
LevelNumber (me) returns mutable IntParam;
|
||||
---Purpose : Returns the Level criterium. NullHandle if not yet set
|
||||
-- (interpreted as Level = 0 : no level number attached)
|
||||
|
||||
Sort (me; rank : Integer; ent : Transient; model : InterfaceModel)
|
||||
returns Boolean;
|
||||
---Purpose : Returns True if <ent> is an IGES Entity with Level Number
|
||||
-- admits the criterium (= value if single level, or one of the
|
||||
-- attached level numbers = value if level list)
|
||||
|
||||
ExtractLabel (me) returns AsciiString from TCollection;
|
||||
---Purpose : Returns the Selection criterium :
|
||||
-- "IGES Entity, Level Number admits <nn>" (if nn > 0) or
|
||||
-- "IGES Entity attached to no Level" (if nn = 0)
|
||||
|
||||
fields
|
||||
|
||||
thelevnum : IntParam;
|
||||
|
||||
end SelectLevelNumber;
|
53
src/IGESSelect/IGESSelect_SelectLevelNumber.cxx
Executable file
53
src/IGESSelect/IGESSelect_SelectLevelNumber.cxx
Executable file
@@ -0,0 +1,53 @@
|
||||
#include <IGESSelect_SelectLevelNumber.ixx>
|
||||
#include <IGESData_IGESEntity.hxx>
|
||||
#include <IGESGraph_DefinitionLevel.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
|
||||
IGESSelect_SelectLevelNumber::IGESSelect_SelectLevelNumber () { }
|
||||
|
||||
|
||||
void IGESSelect_SelectLevelNumber::SetLevelNumber
|
||||
(const Handle(IFSelect_IntParam)& levnum)
|
||||
{ thelevnum = levnum; }
|
||||
|
||||
Handle(IFSelect_IntParam) IGESSelect_SelectLevelNumber::LevelNumber () const
|
||||
{ return thelevnum; }
|
||||
|
||||
|
||||
Standard_Boolean IGESSelect_SelectLevelNumber::Sort
|
||||
(const Standard_Integer rank, const Handle(Standard_Transient)& ent,
|
||||
const Handle(Interface_InterfaceModel)& model) const
|
||||
{
|
||||
DeclareAndCast(IGESData_IGESEntity,igesent,ent);
|
||||
if (igesent.IsNull()) return Standard_False;
|
||||
Standard_Integer numlev = 0;
|
||||
if (!thelevnum.IsNull()) numlev = thelevnum->Value();
|
||||
DeclareAndCast(IGESGraph_DefinitionLevel,levelist,igesent->LevelList());
|
||||
Standard_Integer level = igesent->Level();
|
||||
if (levelist.IsNull()) return (level == numlev);
|
||||
// Cas d une liste
|
||||
if (numlev == 0) return Standard_False;
|
||||
Standard_Integer nb = levelist->NbPropertyValues();
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) {
|
||||
level = levelist->LevelNumber(i);
|
||||
if (level == numlev) return Standard_True;
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
|
||||
TCollection_AsciiString IGESSelect_SelectLevelNumber::ExtractLabel
|
||||
() const
|
||||
{
|
||||
char labl [50];
|
||||
Standard_Integer numlev = 0;
|
||||
if (!thelevnum.IsNull()) numlev = thelevnum->Value();
|
||||
if (numlev == 0) return TCollection_AsciiString
|
||||
("IGES Entity attached to no Level");
|
||||
|
||||
sprintf(labl,"IGES Entity, Level Number admitting %d",numlev);
|
||||
return TCollection_AsciiString (labl);
|
||||
}
|
44
src/IGESSelect/IGESSelect_SelectName.cdl
Executable file
44
src/IGESSelect/IGESSelect_SelectName.cdl
Executable file
@@ -0,0 +1,44 @@
|
||||
-- File: VDASelect_SelectName.cdl
|
||||
-- Created: Tue May 31 18:15:22 1994
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@topsn2>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
class SelectName from IGESSelect inherits SelectExtract
|
||||
|
||||
---Purpose : Selects Entities which have a given name.
|
||||
-- Consider Property Name if present, else Short Label, but
|
||||
-- not the Subscript Number
|
||||
-- First version : keeps exact name
|
||||
-- Later : regular expression
|
||||
|
||||
uses AsciiString from TCollection, HAsciiString from TCollection,
|
||||
Transient, InterfaceModel
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable SelectName;
|
||||
---Purpose : Creates an empty SelectName : every entity is considered
|
||||
-- good (no filter active)
|
||||
|
||||
Sort (me; rank : Integer; ent : Transient; model : InterfaceModel)
|
||||
returns Boolean;
|
||||
---Purpose : Returns True if Name of Entity complies with Name Filter
|
||||
|
||||
SetName (me : mutable; name : HAsciiString from TCollection);
|
||||
---Purpose : Sets a Name as a criterium : IGES Entities which have this name
|
||||
-- are kept (without regular expression, there should be at most
|
||||
-- one). <name> can be regarded as a Text Parameter
|
||||
|
||||
Name (me) returns HAsciiString from TCollection;
|
||||
---Purpose : Returns the Name used as Filter
|
||||
|
||||
ExtractLabel (me) returns AsciiString from TCollection;
|
||||
---Purpose : Returns the Selection criterium : "IGES Entity, Name : <name>"
|
||||
|
||||
fields
|
||||
|
||||
thename : HAsciiString from TCollection;
|
||||
|
||||
end SelectName;
|
52
src/IGESSelect/IGESSelect_SelectName.cxx
Executable file
52
src/IGESSelect/IGESSelect_SelectName.cxx
Executable file
@@ -0,0 +1,52 @@
|
||||
#include <IGESSelect_SelectName.ixx>
|
||||
#include <IGESData_IGESEntity.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
IGESSelect_SelectName::IGESSelect_SelectName () { }
|
||||
|
||||
|
||||
void IGESSelect_SelectName::SetName
|
||||
(const Handle(TCollection_HAsciiString)& levnum)
|
||||
{ thename = levnum; }
|
||||
|
||||
Handle(TCollection_HAsciiString) IGESSelect_SelectName::Name () const
|
||||
{ return thename; }
|
||||
|
||||
|
||||
Standard_Boolean IGESSelect_SelectName::Sort
|
||||
(const Standard_Integer rank, const Handle(Standard_Transient)& ent,
|
||||
const Handle(Interface_InterfaceModel)& model) const
|
||||
{
|
||||
DeclareAndCast(IGESData_IGESEntity,igesent,ent);
|
||||
if (igesent.IsNull()) return Standard_False;
|
||||
if (!igesent->HasName()) return Standard_False;
|
||||
if (thename.IsNull()) return Standard_False;
|
||||
Handle(TCollection_HAsciiString) name = igesent->NameValue();
|
||||
// cout<<"SelectName:"<<thename->ToCString()<<",with:"<<name->ToCString()<<",IsSameString="<<thename->IsSameString (name,Standard_False)<<endl;
|
||||
Standard_Integer nb0 = thename->Length();
|
||||
Standard_Integer nb1 = name->Length();
|
||||
Standard_Integer nbf = (nb1 <= nb0 ? nb1 : nb0);
|
||||
Standard_Integer nbt = (nb1 >= nb0 ? nb1 : nb0);
|
||||
Standard_Integer i; // svv Jan11 2000 : porting on DEC
|
||||
for (i = 1; i <= nbf; i ++) {
|
||||
if (name->Value(i) != thename->Value(i)) return Standard_False;
|
||||
}
|
||||
if (nb0 > nb1) name = thename;
|
||||
for (i = nbf+1; i <= nbt; i ++) {
|
||||
if (name->Value(i) != ' ') return Standard_False;
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
TCollection_AsciiString IGESSelect_SelectName::ExtractLabel () const
|
||||
{
|
||||
char labl [50];
|
||||
if (!thename.IsNull()) {
|
||||
sprintf (labl,"IGES Entity, Name : %s",thename->ToCString());
|
||||
return TCollection_AsciiString(labl);
|
||||
}
|
||||
else return TCollection_AsciiString ("IGES Entity, Name : (undefined)");
|
||||
}
|
38
src/IGESSelect/IGESSelect_SelectPCurves.cdl
Executable file
38
src/IGESSelect/IGESSelect_SelectPCurves.cdl
Executable file
@@ -0,0 +1,38 @@
|
||||
-- File: IGESSelect_SelectPCurves.cdl
|
||||
-- Created: Fri Feb 26 15:19:07 1999
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@heliox.paris1.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 1999
|
||||
|
||||
|
||||
class SelectPCurves from IGESSelect inherits SelectExplore
|
||||
|
||||
---Purpose : This Selection returns the pcurves which lie on a face
|
||||
-- In two modes : global (i.e. a CompositeCurve is not explored)
|
||||
-- or basic (all the basic curves are listed)
|
||||
|
||||
uses AsciiString from TCollection, Transient, EntityIterator, Graph
|
||||
|
||||
is
|
||||
|
||||
Create (basic : Boolean) returns mutable SelectPCurves;
|
||||
---Purpose : Creates a SelectPCurves
|
||||
-- basic True : lists all the components of pcurves
|
||||
-- basic False : lists the uppest level definitions
|
||||
-- (i.e. stops at CompositeCurve)
|
||||
|
||||
Explore (me; level : Integer; ent : Transient; G : Graph;
|
||||
explored : in out EntityIterator)
|
||||
returns Boolean;
|
||||
---Purpose : Explores an entity, to take its contained PCurves
|
||||
-- An independant curve is IGNORED : only faces are explored
|
||||
|
||||
ExploreLabel (me) returns AsciiString from TCollection;
|
||||
---Purpose : Returns a text defining the criterium : "Basic PCurves" or
|
||||
-- "Global PCurves"
|
||||
|
||||
fields
|
||||
|
||||
thebasic : Boolean;
|
||||
|
||||
end SelectPCurves;
|
133
src/IGESSelect/IGESSelect_SelectPCurves.cxx
Executable file
133
src/IGESSelect/IGESSelect_SelectPCurves.cxx
Executable file
@@ -0,0 +1,133 @@
|
||||
#include <IGESSelect_SelectPCurves.ixx>
|
||||
#include <IGESData_IGESEntity.hxx>
|
||||
#include <IGESGeom_CurveOnSurface.hxx>
|
||||
#include <IGESGeom_TrimmedSurface.hxx>
|
||||
#include <IGESGeom_BoundedSurface.hxx>
|
||||
#include <IGESGeom_Boundary.hxx>
|
||||
#include <IGESBasic_Group.hxx>
|
||||
#include <IGESSolid_ManifoldSolid.hxx>
|
||||
#include <IGESSolid_Shell.hxx>
|
||||
#include <IGESSolid_Face.hxx>
|
||||
#include <IGESSolid_Loop.hxx>
|
||||
#include <IGESSelect_SelectBasicGeom.hxx>
|
||||
|
||||
#include <Interface_Macros.hxx>
|
||||
|
||||
IGESSelect_SelectPCurves::IGESSelect_SelectPCurves
|
||||
(const Standard_Boolean basic)
|
||||
: IFSelect_SelectExplore (-1) , thebasic (basic) { }
|
||||
|
||||
|
||||
Standard_Boolean IGESSelect_SelectPCurves::Explore
|
||||
(const Standard_Integer level, const Handle(Standard_Transient)& ent,
|
||||
const Interface_Graph& G, Interface_EntityIterator& explored) const
|
||||
{
|
||||
DeclareAndCast(IGESData_IGESEntity,igesent,ent);
|
||||
if (igesent.IsNull()) return Standard_False;
|
||||
Standard_Integer igt = igesent->TypeNumber();
|
||||
|
||||
// TrimmedSurface 144
|
||||
if (igt == 144) {
|
||||
DeclareAndCast(IGESGeom_TrimmedSurface,trs,ent);
|
||||
explored.AddItem(trs->OuterContour());
|
||||
Standard_Integer i, nb = trs->NbInnerContours();
|
||||
for (i = 1; i <= nb; i ++) explored.AddItem (trs->InnerContour(i));
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
// CurveOnSurface 142
|
||||
if (igt == 142) {
|
||||
DeclareAndCast(IGESGeom_CurveOnSurface,crf,ent);
|
||||
explored.AddItem(crf->CurveUV());
|
||||
if (thebasic) IGESSelect_SelectBasicGeom::SubCurves (crf->CurveUV(),explored);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
// Boundary 141
|
||||
if (igt == 141) {
|
||||
DeclareAndCast(IGESGeom_Boundary,bnd,ent);
|
||||
Standard_Integer i, nb = bnd->NbModelSpaceCurves();
|
||||
for (i = 1; i <= nb; i ++) {
|
||||
Standard_Integer j,np = bnd->NbParameterCurves(i);
|
||||
for (j = 1; j <= np; j ++) {
|
||||
explored.AddItem (bnd->ParameterCurve(i,j));
|
||||
}
|
||||
}
|
||||
return (nb > 0);
|
||||
}
|
||||
|
||||
// BoundedSurface 143
|
||||
if (igt == 143) {
|
||||
DeclareAndCast(IGESGeom_BoundedSurface,bns,ent);
|
||||
Standard_Integer i, nb = bns->NbBoundaries(); //szv#4:S4163:12Mar99 optimized
|
||||
for (i = 1; i <= nb; i ++) explored.AddItem (bns->Boundary(i));
|
||||
return (nb != 0);
|
||||
//return Standard_True; //szv#4:S4163:12Mar99 unreached
|
||||
}
|
||||
|
||||
|
||||
// Groups ... en dernier de la serie 402
|
||||
if (igt == 402) {
|
||||
DeclareAndCast(IGESBasic_Group,gr,ent);
|
||||
if (gr.IsNull()) return Standard_False;
|
||||
Standard_Integer i, nb = gr->NbEntities();
|
||||
for (i = 1; i <= nb; i ++) explored.AddItem (gr->Entity(i));
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
// ManifoldSolid 186 -> Shells
|
||||
if (igt == 186) {
|
||||
DeclareAndCast(IGESSolid_ManifoldSolid,msb,ent);
|
||||
explored.AddItem (msb->Shell());
|
||||
Standard_Integer i, nb = msb->NbVoidShells();
|
||||
for (i = 1; i <= nb; i ++) explored.AddItem (msb->VoidShell(i));
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
// Shell 514 -> Faces
|
||||
if (igt == 514) {
|
||||
DeclareAndCast(IGESSolid_Shell,sh,ent);
|
||||
Standard_Integer i, nb = sh->NbFaces();
|
||||
for (i = 1; i <= nb; i ++) explored.AddItem (sh->Face(i));
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
// Face 510 -> Loops
|
||||
if (igt == 510) {
|
||||
DeclareAndCast(IGESSolid_Face,fc,ent);
|
||||
Standard_Integer i, nb = fc->NbLoops();
|
||||
for (i = 1; i <= nb; i ++) explored.AddItem (fc->Loop(i));
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
// Loop 508 -> PCurves (enfin !)
|
||||
if (igt == 508) {
|
||||
DeclareAndCast(IGESSolid_Loop,lp,ent);
|
||||
Standard_Integer i, nb = lp->NbEdges();
|
||||
for (i = 1; i <= nb; i ++) {
|
||||
Standard_Integer j, np = lp->NbParameterCurves(i);
|
||||
for (j = 1; j <= np; j ++) //szv#4:S4163:12Mar99 was bug
|
||||
explored.AddItem(lp->ParametricCurve(i,j));
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
// LES LIGNES : seult si en tant que pcurve : donc level >= 3
|
||||
// Lignes en general. Attention CopiousData, aux variantes "habillage"
|
||||
if (level < 3) return Standard_False;
|
||||
|
||||
if (igt == 106) return (igesent->FormNumber() < 20);
|
||||
if ( (igt >= 100 && igt <= 106) || igt == 110 || igt == 112 || igt == 116 ||
|
||||
igt == 126 || igt == 130) return Standard_True;
|
||||
|
||||
// Pas trouve
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
|
||||
TCollection_AsciiString IGESSelect_SelectPCurves::ExploreLabel () const
|
||||
{
|
||||
if (thebasic) return TCollection_AsciiString ("Basic PCurves");
|
||||
else return TCollection_AsciiString ("Global PCurves");
|
||||
}
|
35
src/IGESSelect/IGESSelect_SelectSingleViewFrom.cdl
Executable file
35
src/IGESSelect/IGESSelect_SelectSingleViewFrom.cdl
Executable file
@@ -0,0 +1,35 @@
|
||||
-- File: IGESSelect_SelectSingleViewFrom.cdl
|
||||
-- Created: Wed Jun 1 15:46:31 1994
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@bravox>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
class SelectSingleViewFrom from IGESSelect inherits SelectDeduct
|
||||
|
||||
---Purpose : This selection gets the Single Views attached to its input
|
||||
-- IGES entities. Single Views themselves or Drawings as passed
|
||||
-- as such (Drawings, for their Annotations)
|
||||
|
||||
|
||||
uses AsciiString from TCollection, EntityIterator, Graph
|
||||
|
||||
raises InterfaceError
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable SelectSingleViewFrom;
|
||||
---Purpose : Creates a SelectSingleViewFrom
|
||||
|
||||
HasUniqueResult (me) returns Boolean is redefined protected;
|
||||
---Purpose : Returns True, because selection works with a ViewSorter which
|
||||
-- gives a unique result
|
||||
|
||||
RootResult (me; G : Graph) returns EntityIterator raises InterfaceError;
|
||||
---Purpose : Selects the Single Views attached (in Directory Part) to
|
||||
-- input entities
|
||||
|
||||
Label (me) returns AsciiString from TCollection;
|
||||
---Purpose : Returns the label, with is "Single Views attached"
|
||||
|
||||
end SelectSingleViewFrom;
|
30
src/IGESSelect/IGESSelect_SelectSingleViewFrom.cxx
Executable file
30
src/IGESSelect/IGESSelect_SelectSingleViewFrom.cxx
Executable file
@@ -0,0 +1,30 @@
|
||||
#include <IGESSelect_SelectSingleViewFrom.ixx>
|
||||
#include <IGESSelect_ViewSorter.hxx>
|
||||
#include <IGESData_IGESModel.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
|
||||
|
||||
|
||||
IGESSelect_SelectSingleViewFrom::IGESSelect_SelectSingleViewFrom () { }
|
||||
|
||||
Standard_Boolean IGESSelect_SelectSingleViewFrom::HasUniqueResult () const
|
||||
{ return Standard_True; }
|
||||
|
||||
Interface_EntityIterator IGESSelect_SelectSingleViewFrom::RootResult
|
||||
(const Interface_Graph& G) const
|
||||
{
|
||||
Handle(IGESSelect_ViewSorter) sorter = new IGESSelect_ViewSorter;
|
||||
sorter->SetModel (GetCasted(IGESData_IGESModel,G.Model()));
|
||||
sorter->Clear();
|
||||
sorter->AddList (InputResult(G).Content());
|
||||
sorter->SortSingleViews(Standard_True);
|
||||
Interface_EntityIterator list;
|
||||
Standard_Integer nb = sorter->NbSets(Standard_True);
|
||||
for (Standard_Integer i = 1; i <= nb; i ++)
|
||||
list.GetOneItem(sorter->SetItem(i,Standard_True));
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
TCollection_AsciiString IGESSelect_SelectSingleViewFrom::Label () const
|
||||
{ return TCollection_AsciiString ("Single Views attached"); }
|
45
src/IGESSelect/IGESSelect_SelectSubordinate.cdl
Executable file
45
src/IGESSelect/IGESSelect_SelectSubordinate.cdl
Executable file
@@ -0,0 +1,45 @@
|
||||
-- File: IGESSelect_SelectSubordinate.cdl
|
||||
-- Created: Fri Oct 11 09:30:23 1996
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@heliox.paris1.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 1996
|
||||
|
||||
|
||||
class SelectSubordinate from IGESSelect inherits SelectExtract
|
||||
|
||||
---Purpose : This selections uses Subordinate Status as sort criterium
|
||||
-- It is an integer number which can be :
|
||||
-- 0 Independant
|
||||
-- 1 Physically Dependant
|
||||
-- 2 Logically Dependant
|
||||
-- 3 Both (recorded)
|
||||
-- + to sort :
|
||||
-- 4 : 1 or 3 -> at least Physically
|
||||
-- 5 : 2 or 3 -> at least Logically
|
||||
-- 6 : 1 or 2 or 3 -> any kind of dependance
|
||||
-- (corresponds to 0 reversed)
|
||||
|
||||
uses AsciiString from TCollection, Transient, InterfaceModel
|
||||
|
||||
is
|
||||
|
||||
Create (status : Integer) returns mutable SelectSubordinate;
|
||||
---Purpose : Creates a SelectSubordinate with a status to be sorted
|
||||
|
||||
Status (me) returns Integer;
|
||||
---Purpose : Returns the status used for sorting
|
||||
|
||||
Sort (me; rank : Integer; ent : Transient; model : InterfaceModel)
|
||||
returns Boolean;
|
||||
---Purpose : Returns True if <ent> is an IGES Entity with Subordinate
|
||||
-- Status matching the criterium
|
||||
|
||||
ExtractLabel (me) returns AsciiString from TCollection;
|
||||
---Purpose : Returns the Selection criterium : "IGES Entity, Independant"
|
||||
-- etc...
|
||||
|
||||
fields
|
||||
|
||||
thestatus : Integer;
|
||||
|
||||
end SelectSubordinate;
|
38
src/IGESSelect/IGESSelect_SelectSubordinate.cxx
Executable file
38
src/IGESSelect/IGESSelect_SelectSubordinate.cxx
Executable file
@@ -0,0 +1,38 @@
|
||||
#include <IGESSelect_SelectSubordinate.ixx>
|
||||
#include <IGESData_IGESEntity.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
|
||||
|
||||
|
||||
IGESSelect_SelectSubordinate::IGESSelect_SelectSubordinate
|
||||
(const Standard_Integer status) { thestatus = status; }
|
||||
|
||||
Standard_Integer IGESSelect_SelectSubordinate::Status () const
|
||||
{ return thestatus; }
|
||||
|
||||
Standard_Boolean IGESSelect_SelectSubordinate::Sort
|
||||
(const Standard_Integer, const Handle(Standard_Transient)& ent,
|
||||
const Handle(Interface_InterfaceModel)& model) const
|
||||
{
|
||||
DeclareAndCast(IGESData_IGESEntity,igesent,ent);
|
||||
if (igesent.IsNull()) return Standard_False;
|
||||
Standard_Integer sub = igesent->SubordinateStatus();
|
||||
if (sub == thestatus) return Standard_True;
|
||||
if (thestatus == 4 && (sub == 1 || sub == 3)) return Standard_True;
|
||||
if (thestatus == 5 && (sub == 2 || sub == 3)) return Standard_True;
|
||||
if (thestatus == 6 && sub != 0) return Standard_True;
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
TCollection_AsciiString IGESSelect_SelectSubordinate::ExtractLabel () const
|
||||
{
|
||||
TCollection_AsciiString lab("IGESEntity, Subordinate ");
|
||||
if (thestatus == 0) lab.AssignCat("Independant (0)");
|
||||
if (thestatus == 1) lab.AssignCat("Physically only Dependant (1)");
|
||||
if (thestatus == 2) lab.AssignCat("Logically only Dependant (2) ");
|
||||
if (thestatus == 3) lab.AssignCat("Both Phys. and Log. Dependant (3)");
|
||||
if (thestatus == 4) lab.AssignCat("Physically Dependant (1 or 3)");
|
||||
if (thestatus == 5) lab.AssignCat("Logically Dependant (2 or 3)");
|
||||
if (thestatus == 6) lab.AssignCat("Dependant in any way (1 or 2 or 3)");
|
||||
return lab;
|
||||
}
|
29
src/IGESSelect/IGESSelect_SelectVisibleStatus.cdl
Executable file
29
src/IGESSelect/IGESSelect_SelectVisibleStatus.cdl
Executable file
@@ -0,0 +1,29 @@
|
||||
-- File: IGESSelect_SelectVisibleStatus.cdl
|
||||
-- Created: Tue May 31 17:48:31 1994
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@bravox>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
class SelectVisibleStatus from IGESSelect inherits SelectExtract
|
||||
|
||||
---Purpose : This selection looks at Blank Status of IGES Entities
|
||||
-- Direct selection keeps Visible Entities (Blank = 0),
|
||||
-- Reverse selection keeps Blanked Entities (Blank = 1)
|
||||
|
||||
|
||||
uses AsciiString from TCollection, Transient, InterfaceModel
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable SelectVisibleStatus;
|
||||
---Purpose : Creates a SelectVisibleStatus
|
||||
|
||||
Sort (me; rank : Integer; ent : Transient; model : InterfaceModel)
|
||||
returns Boolean;
|
||||
---Purpose : Returns True if <ent> is an IGES Entity with Blank Status = 0
|
||||
|
||||
ExtractLabel (me) returns AsciiString from TCollection;
|
||||
---Purpose : Returns the Selection criterium : "IGES Entity, Status Visible"
|
||||
|
||||
end SelectVisibleStatus;
|
21
src/IGESSelect/IGESSelect_SelectVisibleStatus.cxx
Executable file
21
src/IGESSelect/IGESSelect_SelectVisibleStatus.cxx
Executable file
@@ -0,0 +1,21 @@
|
||||
#include <IGESSelect_SelectVisibleStatus.ixx>
|
||||
#include <IGESData_IGESEntity.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
|
||||
|
||||
|
||||
IGESSelect_SelectVisibleStatus::IGESSelect_SelectVisibleStatus () { }
|
||||
|
||||
|
||||
Standard_Boolean IGESSelect_SelectVisibleStatus::Sort
|
||||
(const Standard_Integer rank, const Handle(Standard_Transient)& ent,
|
||||
const Handle(Interface_InterfaceModel)& model) const
|
||||
{
|
||||
DeclareAndCast(IGESData_IGESEntity,igesent,ent);
|
||||
if (igesent.IsNull()) return Standard_False;
|
||||
return (igesent->BlankStatus() == 0);
|
||||
}
|
||||
|
||||
TCollection_AsciiString IGESSelect_SelectVisibleStatus::ExtractLabel
|
||||
() const
|
||||
{ return TCollection_AsciiString ("IGES Entity, Status Visible"); }
|
57
src/IGESSelect/IGESSelect_SetGlobalParameter.cdl
Executable file
57
src/IGESSelect/IGESSelect_SetGlobalParameter.cdl
Executable file
@@ -0,0 +1,57 @@
|
||||
-- File: IGESSelect_SetGlobalParameter.cdl
|
||||
-- Created: Wed Jun 1 17:01:32 1994
|
||||
-- Author: Modelistation
|
||||
-- <model@bravox>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
class SetGlobalParameter from IGESSelect inherits ModelModifier from IGESSelect
|
||||
|
||||
---Purpose : Sets a Global (Header) Parameter to a new value, directly given
|
||||
-- Controls the form of the parameter (Integer, Real, String
|
||||
-- with such or such form), but not the consistence of the new
|
||||
-- value regarding the rest of the file.
|
||||
--
|
||||
-- The new value is given under the form of a HAsciiString, even
|
||||
-- for Integer or Real values. For String values, Hollerith forms
|
||||
-- are accepted but not mandatory
|
||||
-- Warning : a Null (not set) value is not accepted. For an empty string,
|
||||
-- give a Text Parameter which is empty
|
||||
|
||||
uses AsciiString from TCollection, HAsciiString from TCollection,
|
||||
IGESModel, CopyTool, ContextModif
|
||||
|
||||
is
|
||||
|
||||
Create (numpar : Integer) returns mutable SetGlobalParameter;
|
||||
---Purpose : Creates an SetGlobalParameter, to be applied on Global
|
||||
-- Parameter <numpar>
|
||||
|
||||
GlobalNumber (me) returns Integer;
|
||||
---Purpose : Returns the global parameter number to which this modifiers
|
||||
-- applies
|
||||
|
||||
SetValue (me : mutable; text : mutable HAsciiString);
|
||||
---Purpose : Sets a Text Parameter for the new value
|
||||
|
||||
Value (me) returns mutable HAsciiString;
|
||||
---Purpose : Returns the value to set to the global parameter (Text Param)
|
||||
|
||||
|
||||
Performing (me; ctx : in out ContextModif;
|
||||
target : mutable IGESModel;
|
||||
TC : in out CopyTool);
|
||||
---Purpose : Specific action : only <target> is used : the form of the new
|
||||
-- value is checked regarding the parameter number (given at
|
||||
-- creation time).
|
||||
|
||||
Label (me) returns AsciiString from TCollection;
|
||||
---Purpose : Returns a text which is
|
||||
-- "Sets Global Parameter <numpar> to <new value>"
|
||||
|
||||
fields
|
||||
|
||||
thenum : Integer;
|
||||
theval : HAsciiString from TCollection;
|
||||
|
||||
end SetGlobalParameter;
|
58
src/IGESSelect/IGESSelect_SetGlobalParameter.cxx
Executable file
58
src/IGESSelect/IGESSelect_SetGlobalParameter.cxx
Executable file
@@ -0,0 +1,58 @@
|
||||
#include <IGESSelect_SetGlobalParameter.ixx>
|
||||
#include <IGESData_GlobalSection.hxx>
|
||||
#include <Interface_ParamSet.hxx>
|
||||
#include <Interface_FileParameter.hxx>
|
||||
#include <stdio.h>
|
||||
#include <Interface_Check.hxx>
|
||||
|
||||
|
||||
IGESSelect_SetGlobalParameter::IGESSelect_SetGlobalParameter
|
||||
(const Standard_Integer numpar)
|
||||
: IGESSelect_ModelModifier (Standard_False)
|
||||
{ thenum = numpar; }
|
||||
|
||||
Standard_Integer IGESSelect_SetGlobalParameter::GlobalNumber () const
|
||||
{ return thenum; }
|
||||
|
||||
void IGESSelect_SetGlobalParameter::SetValue
|
||||
(const Handle(TCollection_HAsciiString)& text)
|
||||
{ theval = text; }
|
||||
|
||||
Handle(TCollection_HAsciiString) IGESSelect_SetGlobalParameter::Value
|
||||
() const
|
||||
{ return theval; }
|
||||
|
||||
|
||||
void IGESSelect_SetGlobalParameter::Performing
|
||||
(IFSelect_ContextModif& ctx,
|
||||
const Handle(IGESData_IGESModel)& target,
|
||||
Interface_CopyTool& ) const
|
||||
{
|
||||
if (theval.IsNull()) {
|
||||
ctx.CCheck()->AddWarning("Set IGES Global Parameter, no value defined, ignored");
|
||||
return;
|
||||
}
|
||||
IGESData_GlobalSection GS = target->GlobalSection();
|
||||
Handle(Interface_ParamSet) oldset = GS.Params();
|
||||
if (thenum <= 0 || thenum > oldset->NbParams()) {
|
||||
char mess[80];
|
||||
sprintf(mess,"Set IGES Global Parameter : Number %d incorrect",thenum);
|
||||
ctx.CCheck()->AddFail(mess);
|
||||
return;
|
||||
}
|
||||
Interface_FileParameter& FP = oldset->ChangeParam (thenum);
|
||||
FP.Init (theval->ToCString(),FP.ParamType());
|
||||
Handle(Interface_Check) check = new Interface_Check;
|
||||
GS.Init (oldset,check);
|
||||
ctx.AddCheck(check);
|
||||
if (!check->HasFailed()) target->SetGlobalSection(GS);
|
||||
}
|
||||
|
||||
TCollection_AsciiString IGESSelect_SetGlobalParameter::Label () const
|
||||
{
|
||||
char mess[80];
|
||||
if (theval.IsNull()) sprintf(mess,"Set IGES Global Parameter (undefined)");
|
||||
else sprintf(mess,"Set IGES Global Parameter Number %d to %s",
|
||||
thenum,theval->ToCString());
|
||||
return TCollection_AsciiString (mess);
|
||||
}
|
41
src/IGESSelect/IGESSelect_SetLabel.cdl
Executable file
41
src/IGESSelect/IGESSelect_SetLabel.cdl
Executable file
@@ -0,0 +1,41 @@
|
||||
-- File: IGESSelect_SetLabel.cdl
|
||||
-- Created: Fri Feb 26 12:45:55 1999
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@heliox.paris1.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 1999
|
||||
|
||||
|
||||
class SetLabel from IGESSelect inherits ModelModifier from IGESSelect
|
||||
|
||||
---Purpose : Sets/Clears Short Label of Entities, those designated by the
|
||||
-- Selection. No Selection means all the file
|
||||
--
|
||||
-- May enforce, else it sets only if no label is yet set
|
||||
-- Mode : 0 to clear (always enforced)
|
||||
-- 1 to set label to DE number (changes it if already set)
|
||||
|
||||
uses AsciiString from TCollection,
|
||||
IGESModel, CopyTool, ContextModif
|
||||
|
||||
is
|
||||
|
||||
Create (mode : Integer; enforce : Boolean) returns SetLabel;
|
||||
---Purpose : Creates a SetLabel for IGESEntity
|
||||
-- Mode : see Purpose of the class
|
||||
|
||||
Performing (me; ctx : in out ContextModif;
|
||||
target : mutable IGESModel;
|
||||
TC : in out CopyTool);
|
||||
---Purpose : Specific action : Sets or Clears the Label
|
||||
|
||||
Label (me) returns AsciiString from TCollection;
|
||||
---Purpose : Returns a text which is
|
||||
-- "Clear Short Label" or "Set Label to DE"
|
||||
-- With possible additional information " (enforced)"
|
||||
|
||||
fields
|
||||
|
||||
themode : Integer;
|
||||
theforce : Boolean;
|
||||
|
||||
end SetLabel;
|
48
src/IGESSelect/IGESSelect_SetLabel.cxx
Executable file
48
src/IGESSelect/IGESSelect_SetLabel.cxx
Executable file
@@ -0,0 +1,48 @@
|
||||
#include <IGESSelect_SetLabel.ixx>
|
||||
#include <Interface_Macros.hxx>
|
||||
#include <IGESData_IGESEntity.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
|
||||
IGESSelect_SetLabel::IGESSelect_SetLabel
|
||||
(const Standard_Integer mode, const Standard_Boolean enforce)
|
||||
: IGESSelect_ModelModifier (Standard_False) ,
|
||||
themode (mode) , theforce (enforce) { }
|
||||
|
||||
void IGESSelect_SetLabel::Performing
|
||||
(IFSelect_ContextModif& ctx,
|
||||
const Handle(IGESData_IGESModel)& target,
|
||||
Interface_CopyTool& TC) const
|
||||
{
|
||||
Handle(TCollection_HAsciiString) lab;
|
||||
for (ctx.Start(); ctx.More(); ctx.Next()) {
|
||||
DeclareAndCast(IGESData_IGESEntity,iges,ctx.ValueResult());
|
||||
if (iges.IsNull()) continue;
|
||||
if (themode == 0) { iges->SetLabel(lab); continue; }
|
||||
|
||||
// mode = 1 : mettre DEnnn , nnn est le DE Number
|
||||
lab = iges->ShortLabel();
|
||||
if (theforce) lab.Nullify();
|
||||
if (!lab.IsNull()) {
|
||||
if (lab->Length() > 2) {
|
||||
if (lab->Value(1) == 'D' && lab->Value(2) == 'E' &&
|
||||
atoi( &(lab->ToCString())[2] ) > 0)
|
||||
lab.Nullify();
|
||||
}
|
||||
}
|
||||
// Si lab nul : le recalculer
|
||||
if (lab.IsNull()) {
|
||||
lab = new TCollection_HAsciiString(target->Number(iges)*2-1);
|
||||
lab->Insert (1,"DE");
|
||||
}
|
||||
iges->SetLabel(lab);
|
||||
}
|
||||
}
|
||||
|
||||
TCollection_AsciiString IGESSelect_SetLabel::Label () const
|
||||
{
|
||||
TCollection_AsciiString lab;
|
||||
if (themode == 0) lab.AssignCat ("Clear Short Label");
|
||||
if (themode == 1) lab.AssignCat ("Set Short Label to DE Number");
|
||||
if (theforce) lab.AssignCat (" (enforced)");
|
||||
return lab;
|
||||
}
|
36
src/IGESSelect/IGESSelect_SetVersion5.cdl
Executable file
36
src/IGESSelect/IGESSelect_SetVersion5.cdl
Executable file
@@ -0,0 +1,36 @@
|
||||
-- File: IGESSelect_SetVersion5.cdl
|
||||
-- Created: Wed Jun 1 16:26:02 1994
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@bravox>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
class SetVersion5 from IGESSelect inherits ModelModifier from IGESSelect
|
||||
|
||||
---Purpose : Sets IGES Version (coded in global parameter 23) to be at least
|
||||
-- IGES 5.1 . If it is older, it is set to IGES 5.1, and
|
||||
-- LastChangeDate (new Global n0 25) is added (current time)
|
||||
-- Else, it does nothing (i.e. changes neither IGES Version nor
|
||||
-- LastChangeDate)
|
||||
|
||||
uses AsciiString from TCollection,
|
||||
IGESModel, CopyTool, ContextModif
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable SetVersion5;
|
||||
---Purpose : Creates an SetVersion5, which uses the system Date for Last
|
||||
-- Change Date
|
||||
|
||||
Performing (me; ctx : in out ContextModif;
|
||||
target : mutable IGESModel;
|
||||
TC : in out CopyTool);
|
||||
---Purpose : Specific action : only <target> is used : IGES Version (coded)
|
||||
-- is upgraded to 5.1 if it is older, and it this case the new
|
||||
-- global parameter 25 (LastChangeDate) is set to current time
|
||||
|
||||
Label (me) returns AsciiString from TCollection;
|
||||
---Purpose : Returns a text which is
|
||||
-- "Update IGES Version to 5.1"
|
||||
|
||||
end SetVersion5;
|
27
src/IGESSelect/IGESSelect_SetVersion5.cxx
Executable file
27
src/IGESSelect/IGESSelect_SetVersion5.cxx
Executable file
@@ -0,0 +1,27 @@
|
||||
#include <IGESSelect_SetVersion5.ixx>
|
||||
#include <IGESData_GlobalSection.hxx>
|
||||
#include <Interface_Check.hxx>
|
||||
|
||||
|
||||
|
||||
IGESSelect_SetVersion5::IGESSelect_SetVersion5 ()
|
||||
: IGESSelect_ModelModifier (Standard_False) { }
|
||||
|
||||
void IGESSelect_SetVersion5::Performing
|
||||
(IFSelect_ContextModif& ctx,
|
||||
const Handle(IGESData_IGESModel)& target,
|
||||
Interface_CopyTool& ) const
|
||||
{
|
||||
IGESData_GlobalSection GS = target->GlobalSection();
|
||||
if (GS.IGESVersion() >= 9) return;
|
||||
GS.SetIGESVersion(9);
|
||||
GS.SetLastChangeDate ();
|
||||
target->SetGlobalSection(GS);
|
||||
Handle(Interface_Check) check = new Interface_Check;
|
||||
target->VerifyCheck(check);
|
||||
if (check->HasFailed()) ctx.CCheck()->GetMessages(check);
|
||||
}
|
||||
|
||||
|
||||
TCollection_AsciiString IGESSelect_SetVersion5::Label () const
|
||||
{ return TCollection_AsciiString ("Update IGES Version in Global Section to 5.1"); }
|
39
src/IGESSelect/IGESSelect_SignColor.cdl
Executable file
39
src/IGESSelect/IGESSelect_SignColor.cdl
Executable file
@@ -0,0 +1,39 @@
|
||||
-- File: IGESSelect_SignColor.cdl
|
||||
-- Created: Tue Mar 6 17:37:04 2001
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@heliox.paris1.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 2001
|
||||
|
||||
|
||||
class SignColor from IGESSelect inherits Signature from IFSelect
|
||||
|
||||
---Purpose : Gives Color attached to an entity
|
||||
-- Several forms are possible, according to <mode>
|
||||
-- 1 : number : "Dnn" for entity, "Snn" for standard, "(none)" for 0
|
||||
-- 2 : name : Of standard color, or of the color entity, or "(none)"
|
||||
-- (if the color entity has no name, its label is taken)
|
||||
-- 3 : RGB values, form R:nn,G:nn,B:nn
|
||||
-- 4 : RED value : an integer
|
||||
-- 5 : GREEN value : an integer
|
||||
-- 6 : BLUE value : an integer
|
||||
-- Other computable values can be added if needed :
|
||||
-- CMY values, Percentages for Hue, Lightness, Saturation
|
||||
|
||||
uses CString, Transient, AsciiString, InterfaceModel
|
||||
|
||||
is
|
||||
|
||||
Create (mode : Integer) returns SignColor;
|
||||
---Purpose : Creates a SignColor
|
||||
-- mode : see above for the meaning
|
||||
-- modes 4,5,6 give a numeric integer value
|
||||
-- Name is initialised according to the mode
|
||||
|
||||
Value (me; ent : any Transient; model : InterfaceModel) returns CString;
|
||||
---Purpose : Returns the value (see above)
|
||||
|
||||
fields
|
||||
|
||||
themode : Integer;
|
||||
|
||||
end SignColor;
|
146
src/IGESSelect/IGESSelect_SignColor.cxx
Executable file
146
src/IGESSelect/IGESSelect_SignColor.cxx
Executable file
@@ -0,0 +1,146 @@
|
||||
#include <IGESSelect_SignColor.ixx>
|
||||
#include <Interface_Macros.hxx>
|
||||
#include <IGESData_IGESEntity.hxx>
|
||||
#include <IGESGraph_Color.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
|
||||
|
||||
|
||||
static TCollection_AsciiString valbuf; // to prepare value and keep some time
|
||||
|
||||
static Standard_CString ColName (const Standard_Integer mode)
|
||||
{
|
||||
switch (mode) {
|
||||
case 2 : return "IGES Color Name";
|
||||
case 3 : return "IGES Color R,G,B";
|
||||
case 4 : return "IGES Color RED Value";
|
||||
case 5 : return "IGES Color GREEN Value";
|
||||
case 6 : return "IGES Color BLUE Value";
|
||||
default : return "IGES Color Number";
|
||||
}
|
||||
}
|
||||
|
||||
IGESSelect_SignColor::IGESSelect_SignColor (const Standard_Integer mode)
|
||||
: IFSelect_Signature (ColName(mode)) , themode(mode)
|
||||
{ if (mode == 4 || mode == 5 || mode == 6) SetIntCase (Standard_True,0,Standard_True,0); }
|
||||
|
||||
Standard_CString IGESSelect_SignColor::Value
|
||||
(const Handle(Standard_Transient)& ent,
|
||||
const Handle(Interface_InterfaceModel)& model) const
|
||||
{
|
||||
Standard_Real red = -1 , green = -1 , blue = -1;
|
||||
DeclareAndCast(IGESData_IGESEntity,igesent,ent);
|
||||
if (igesent.IsNull()) return "";
|
||||
Standard_Integer rank = igesent->RankColor();
|
||||
DeclareAndCast(IGESGraph_Color,color,igesent->Color());
|
||||
valbuf.Clear();
|
||||
|
||||
// Color Number
|
||||
if (themode < 2 || themode > 6) {
|
||||
if (rank == 0) return "(none)";
|
||||
if (rank > 0) {
|
||||
valbuf.AssignCat ("S");
|
||||
valbuf.AssignCat (IFSelect_Signature::IntValue (rank));
|
||||
} else {
|
||||
Standard_Integer num = (model.IsNull() ? 0 : 2 * model->Number(color) - 1);
|
||||
valbuf.AssignCat ("D");
|
||||
valbuf.AssignCat (IFSelect_Signature::IntValue (num));
|
||||
}
|
||||
|
||||
// Color Name
|
||||
} else if (themode == 2) {
|
||||
switch (rank) {
|
||||
case 0 : return "(none)";
|
||||
case 1 : return "BLACK";
|
||||
case 2 : return "RED";
|
||||
case 3 : return "GREEN";
|
||||
case 4 : return "BLUE";
|
||||
case 5 : return "YELLOW";
|
||||
case 6 : return "MAGENTA";
|
||||
case 7 : return "CYAN";
|
||||
case 8 : return "WHITE";
|
||||
default : if (rank > 0) return "Unknown Number";
|
||||
}
|
||||
Handle(TCollection_HAsciiString) name;
|
||||
if (!color.IsNull()) name = color->ColorName();
|
||||
if (!name.IsNull()) return name->ToCString();
|
||||
Standard_Integer num = (model.IsNull() ? 0 : 2 * model->Number(color) - 1);
|
||||
valbuf.AssignCat ("D");
|
||||
valbuf.AssignCat (IFSelect_Signature::IntValue (num));
|
||||
|
||||
// RGB
|
||||
} else if (themode == 3) {
|
||||
switch (rank) {
|
||||
case 0 : return "";
|
||||
case 1 : return "0,0,0";
|
||||
case 2 : return "100,0,0";
|
||||
case 3 : return "0,100,0";
|
||||
case 4 : return "0,0,100";
|
||||
case 5 : return "100,100,0";
|
||||
case 6 : return "100,0,100";
|
||||
case 7 : return "0,100,100";
|
||||
case 8 : return "100,100,100";
|
||||
default : if (rank > 0) return "";
|
||||
}
|
||||
if (!color.IsNull()) color->RGBIntensity (red,green,blue);
|
||||
if (red >= 0) valbuf.AssignCat ( IFSelect_Signature::IntValue (int(red)) );
|
||||
valbuf.AssignCat (",");
|
||||
if (green >= 0) valbuf.AssignCat (IFSelect_Signature::IntValue (int(green)) );
|
||||
valbuf.AssignCat (",");
|
||||
if (blue >= 0) valbuf.AssignCat ( IFSelect_Signature::IntValue (int(blue)) );
|
||||
|
||||
// RED value
|
||||
} else if (themode == 4) {
|
||||
switch (rank) {
|
||||
case 0 : return "";
|
||||
case 1 : return "0";
|
||||
case 2 : return "100";
|
||||
case 3 : return "0";
|
||||
case 4 : return "0";
|
||||
case 5 : return "100";
|
||||
case 6 : return "100";
|
||||
case 7 : return "0";
|
||||
case 8 : return "100";
|
||||
default : if (rank > 0) return "";
|
||||
}
|
||||
if (!color.IsNull()) color->RGBIntensity (red,green,blue);
|
||||
if (red >= 0) return IFSelect_Signature::IntValue (int(red));
|
||||
|
||||
// GREEN Value
|
||||
} else if (themode == 5) {
|
||||
switch (rank) {
|
||||
case 0 : return "";
|
||||
case 1 : return "0";
|
||||
case 2 : return "0";
|
||||
case 3 : return "100";
|
||||
case 4 : return "0";
|
||||
case 5 : return "100";
|
||||
case 6 : return "0";
|
||||
case 7 : return "100";
|
||||
case 8 : return "100";
|
||||
default : if (rank > 0) return "";
|
||||
}
|
||||
if (!color.IsNull()) color->RGBIntensity (red,green,blue);
|
||||
if (green >= 0) return IFSelect_Signature::IntValue (int(green));
|
||||
|
||||
// BLUE Value
|
||||
} else if (themode == 6) {
|
||||
switch (rank) {
|
||||
case 0 : return "";
|
||||
case 1 : return "0";
|
||||
case 2 : return "0";
|
||||
case 3 : return "0";
|
||||
case 4 : return "100";
|
||||
case 5 : return "0";
|
||||
case 6 : return "100";
|
||||
case 7 : return "100";
|
||||
case 8 : return "100";
|
||||
default : if (rank > 0) return "";
|
||||
}
|
||||
if (!color.IsNull()) color->RGBIntensity (red,green,blue);
|
||||
if (blue >= 0) return IFSelect_Signature::IntValue (int(blue));
|
||||
}
|
||||
|
||||
return valbuf.ToCString();
|
||||
}
|
34
src/IGESSelect/IGESSelect_SignLevelNumber.cdl
Executable file
34
src/IGESSelect/IGESSelect_SignLevelNumber.cdl
Executable file
@@ -0,0 +1,34 @@
|
||||
-- File: IGESSelect_SignLevelNumber.cdl
|
||||
-- Created: Thu Apr 2 10:23:36 1998
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@heliox.paris1.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 1998
|
||||
|
||||
|
||||
class SignLevelNumber from IGESSelect inherits Signature from IFSelect
|
||||
|
||||
---Purpose : Gives D.E. Level Number under two possible forms :
|
||||
-- * for counter : "LEVEL nnnnnnn", " NO LEVEL", " LEVEL LIST"
|
||||
-- * for selection : "/nnn/", "/0/", "/1/2/nnn/"
|
||||
--
|
||||
-- For matching, giving /nn/ gets any entity attached to level nn
|
||||
-- whatever simple or in a level list
|
||||
|
||||
uses CString, Transient, AsciiString, InterfaceModel
|
||||
|
||||
is
|
||||
|
||||
Create (countmode : Boolean) returns mutable SignLevelNumber;
|
||||
---Purpose : Creates a SignLevelNumber
|
||||
-- <countmode> True : values are naturally displayed
|
||||
-- <countmode> False: values are separated by slashes
|
||||
-- in order to allow selection by signature by Draw or C++
|
||||
|
||||
Value (me; ent : any Transient; model : InterfaceModel) returns CString;
|
||||
---Purpose : Returns the value (see above)
|
||||
|
||||
fields
|
||||
|
||||
thecountmode : Boolean;
|
||||
|
||||
end SignLevelNumber;
|
56
src/IGESSelect/IGESSelect_SignLevelNumber.cxx
Executable file
56
src/IGESSelect/IGESSelect_SignLevelNumber.cxx
Executable file
@@ -0,0 +1,56 @@
|
||||
#include <IGESSelect_SignLevelNumber.ixx>
|
||||
#include <IGESData_IGESEntity.hxx>
|
||||
#include <IGESGraph_DefinitionLevel.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
#include <stdio.h>
|
||||
|
||||
static TCollection_AsciiString laval;
|
||||
|
||||
|
||||
IGESSelect_SignLevelNumber::IGESSelect_SignLevelNumber
|
||||
(const Standard_Boolean countmode)
|
||||
: IFSelect_Signature ("Level Number") ,
|
||||
thecountmode (countmode) { }
|
||||
|
||||
Standard_CString IGESSelect_SignLevelNumber::Value
|
||||
(const Handle(Standard_Transient)& ent,
|
||||
const Handle(Interface_InterfaceModel)& /* model */) const
|
||||
{
|
||||
char carlev[20];
|
||||
DeclareAndCast(IGESData_IGESEntity,igesent,ent);
|
||||
//JR/Hp
|
||||
if (igesent.IsNull()) {
|
||||
Standard_CString astr ;
|
||||
astr = (Standard_CString ) (thecountmode ? " NO LEVEL" : "/0/");
|
||||
return astr ;
|
||||
}
|
||||
// if (igesent.IsNull()) return (thecountmode ? " NO LEVEL" : "/0/");
|
||||
DeclareAndCast(IGESGraph_DefinitionLevel,levelist,igesent->LevelList());
|
||||
Standard_Integer level = igesent->Level();
|
||||
|
||||
if (levelist.IsNull()) {
|
||||
//JR/Hp
|
||||
if (level < 0) {
|
||||
Standard_CString astr ;
|
||||
astr = (Standard_CString ) (thecountmode ? " NO LEVEL" : "/0/") ;
|
||||
return astr ;
|
||||
}
|
||||
// if (level < 0) return (thecountmode ? " NO LEVEL" : "/0/");
|
||||
laval.Clear();
|
||||
if (thecountmode) sprintf (carlev,"%7d",level);
|
||||
else sprintf (carlev,"/%d/",level);
|
||||
laval.AssignCat (carlev);
|
||||
}
|
||||
else if (thecountmode) return "LEVEL LIST";
|
||||
else {
|
||||
Standard_Integer i, nblev = levelist->NbLevelNumbers();
|
||||
laval.Clear();
|
||||
laval.AssignCat("LIST:/");
|
||||
for (i = 1; i <= nblev; i ++) {
|
||||
sprintf(carlev,"%d/",levelist->LevelNumber(i));
|
||||
laval.AssignCat(carlev);
|
||||
}
|
||||
}
|
||||
return laval.ToCString();
|
||||
}
|
39
src/IGESSelect/IGESSelect_SignStatus.cdl
Executable file
39
src/IGESSelect/IGESSelect_SignStatus.cdl
Executable file
@@ -0,0 +1,39 @@
|
||||
-- File: IGESSelect_SignStatus.cdl
|
||||
-- Created: Wed Jan 28 17:10:13 1998
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@heliox.paris1.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 1998
|
||||
|
||||
|
||||
class SignStatus from IGESSelect inherits Signature from IFSelect
|
||||
|
||||
---Purpose : Gives D.E. Status under the form i,j,k,l (4 figures)
|
||||
-- i for BlankStatus
|
||||
-- j for SubordinateStatus
|
||||
-- k for UseFlag
|
||||
-- l for Hierarchy
|
||||
--
|
||||
-- For matching, allowed shortcuts
|
||||
-- B(Blanked) or V(Visible) are allowed instead of i
|
||||
-- I(Independant=0), P(Physically Dep.=1), L(Logically Dep.=2) or
|
||||
-- D(Dependant=3) are allowed instead of j
|
||||
-- These letters must be given in their good position
|
||||
-- For non-exact matching :
|
||||
-- a letter (see above), no comma : only this status is checked
|
||||
-- nothing or a star between commas : this status is OK
|
||||
|
||||
uses CString, Transient, AsciiString, InterfaceModel
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable SignStatus;
|
||||
|
||||
Value (me; ent : any Transient; model : InterfaceModel) returns CString;
|
||||
---Purpose : Returns the value (see above)
|
||||
|
||||
Matches (me; ent : Transient; model : InterfaceModel;
|
||||
text : AsciiString; exact : Boolean)
|
||||
returns Boolean is redefined;
|
||||
---Purpose : Performs the match rule (see above)
|
||||
|
||||
end SignStatus;
|
73
src/IGESSelect/IGESSelect_SignStatus.cxx
Executable file
73
src/IGESSelect/IGESSelect_SignStatus.cxx
Executable file
@@ -0,0 +1,73 @@
|
||||
#include <IGESSelect_SignStatus.ixx>
|
||||
#include <IGESData_IGESEntity.hxx>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
static char theval[10];
|
||||
|
||||
IGESSelect_SignStatus::IGESSelect_SignStatus ()
|
||||
: IFSelect_Signature ("D.E. Status") { }
|
||||
|
||||
Standard_CString IGESSelect_SignStatus::Value
|
||||
(const Handle(Standard_Transient)& ent,
|
||||
const Handle(Interface_InterfaceModel)& model) const
|
||||
{
|
||||
Handle(IGESData_IGESEntity) igesent = Handle(IGESData_IGESEntity)::DownCast(ent);
|
||||
if (igesent.IsNull()) return "";
|
||||
Standard_Integer i,j,k,l;
|
||||
i = igesent->BlankStatus ();
|
||||
j = igesent->SubordinateStatus ();
|
||||
k = igesent->UseFlag ();
|
||||
l = igesent->HierarchyStatus ();
|
||||
sprintf (theval,"%d,%d,%d,%d",i,j,k,l);
|
||||
return theval;
|
||||
}
|
||||
|
||||
Standard_Boolean IGESSelect_SignStatus::Matches
|
||||
(const Handle(Standard_Transient)& ent,
|
||||
const Handle(Interface_InterfaceModel)& model,
|
||||
const TCollection_AsciiString& text, const Standard_Boolean exact) const
|
||||
{
|
||||
Handle(IGESData_IGESEntity) igesent = Handle(IGESData_IGESEntity)::DownCast(ent);
|
||||
if (igesent.IsNull()) return Standard_False;
|
||||
Standard_Integer i,j,k,l;
|
||||
i = igesent->BlankStatus ();
|
||||
j = igesent->SubordinateStatus ();
|
||||
k = igesent->UseFlag ();
|
||||
l = igesent->HierarchyStatus ();
|
||||
Standard_Integer n,nb = text.Length();
|
||||
if (nb > 9) nb = 9;
|
||||
for (n = 1; n <= nb; n ++) theval[n-1] = text.Value(n);
|
||||
theval[nb] = '\0';
|
||||
|
||||
Standard_Integer vir = 0, val = 0;
|
||||
for (n = 0; n < nb; n ++) {
|
||||
char car = theval[n];
|
||||
if (car == ',') { vir ++; continue; }
|
||||
val = Standard_Integer (car-48);
|
||||
if (car == 'V' && vir == 0) val = 0;
|
||||
if (car == 'B' && vir == 0) val = 1;
|
||||
if (car == 'I' && vir == 1) val = 0;
|
||||
if (car == 'P' && vir == 1) val = 1;
|
||||
if (car == 'L' && vir == 1) val = 2;
|
||||
if (car == 'D' && vir == 1) val = 3;
|
||||
// Matches ?
|
||||
if (vir == 0) { // Blank
|
||||
if (i == val && !exact) return Standard_True;
|
||||
if (i != val && exact) return Standard_False;
|
||||
}
|
||||
if (vir == 1) { // Subord.
|
||||
if (j == val && !exact) return Standard_True;
|
||||
if (j != val && exact) return Standard_False;
|
||||
}
|
||||
if (vir == 2) { // UseFlag
|
||||
if (k == val && !exact) return Standard_True;
|
||||
if (k != val && exact) return Standard_False;
|
||||
}
|
||||
if (vir == 3) { // Hierarchy
|
||||
if (l == val && !exact) return Standard_True;
|
||||
if (l != val && exact) return Standard_False;
|
||||
}
|
||||
}
|
||||
return exact; // un brin de reflexion pour arriver
|
||||
}
|
63
src/IGESSelect/IGESSelect_SplineToBSpline.cdl
Executable file
63
src/IGESSelect/IGESSelect_SplineToBSpline.cdl
Executable file
@@ -0,0 +1,63 @@
|
||||
-- File: IGESSelect_SplineToBSpline.cdl
|
||||
-- Created: Thu Jun 2 18:18:34 1994
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@bravox>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
class SplineToBSpline from IGESSelect inherits Transformer
|
||||
|
||||
---Purpose : This type of Transformer allows to convert Spline Curves (IGES
|
||||
-- type 112) and Surfaces (IGES Type 126) to BSpline Curves (IGES
|
||||
-- type 114) and Surfac (IGES Type 128). All other entities are
|
||||
-- rebuilt as identical but on the basis of this conversion.
|
||||
--
|
||||
-- It also gives an option to, either convert as such (i.e. each
|
||||
-- starting part of the spline becomes a segment of the bspline,
|
||||
-- with continuity C0 between segments), or try to increase
|
||||
-- continuity as far as possible to C1 or to C2.
|
||||
--
|
||||
-- It does nothing if the starting model contains no Spline
|
||||
-- Curve (IGES Type 112) or Surface (IGES Type 126). Else,
|
||||
-- converting and rebuilding implies copying of entities.
|
||||
|
||||
uses AsciiString from TCollection,
|
||||
CheckIterator, Graph, CopyControl, Protocol from Interface, InterfaceModel
|
||||
|
||||
is
|
||||
|
||||
Create (tryC2 : Boolean) returns mutable SplineToBSpline;
|
||||
---Purpose : Creates a Transformer SplineToBSpline. If <tryC2> is True,
|
||||
-- it will in addition try to upgrade continuity up to C2.
|
||||
|
||||
OptionTryC2 (me) returns Boolean;
|
||||
---Purpose : Returns the option TryC2 given at creation time
|
||||
|
||||
Perform (me : mutable; G : Graph; protocol : Protocol from Interface;
|
||||
checks : in out CheckIterator;
|
||||
newmod : out mutable InterfaceModel) returns Boolean;
|
||||
---Purpose : Performs the transformation, if there is at least one Spline
|
||||
-- Curve (112) or Surface (126). Does nothing if there is none.
|
||||
|
||||
Updated (me; entfrom : Transient; entto : out mutable Transient)
|
||||
returns Boolean;
|
||||
---Purpose : Returns the transformed entities.
|
||||
-- If original data contained no Spline Curve or Surface,
|
||||
-- the result is identity : <entto> = <entfrom>
|
||||
-- Else, the copied counterpart is returned : for a Spline Curve
|
||||
-- or Surface, it is a converted BSpline Curve or Surface. Else,
|
||||
-- it is the result of general service Copy (rebuilt as necessary
|
||||
-- by BSPlines replacing Splines).
|
||||
|
||||
Label (me) returns AsciiString from TCollection;
|
||||
---Purpose : Returns a text which defines the way a Transformer works :
|
||||
-- "Conversion Spline to BSpline" and as opted,
|
||||
-- " trying to upgrade continuity"
|
||||
|
||||
fields
|
||||
|
||||
thetryc2 : Boolean;
|
||||
thefound : Boolean; -- at least one Spline found and converted
|
||||
themap : CopyControl;
|
||||
|
||||
end SplineToBSpline;
|
67
src/IGESSelect/IGESSelect_SplineToBSpline.cxx
Executable file
67
src/IGESSelect/IGESSelect_SplineToBSpline.cxx
Executable file
@@ -0,0 +1,67 @@
|
||||
#include <IGESSelect_SplineToBSpline.ixx>
|
||||
#include <IGESData_IGESEntity.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
#include <Interface_Check.hxx>
|
||||
|
||||
|
||||
|
||||
IGESSelect_SplineToBSpline::IGESSelect_SplineToBSpline
|
||||
(const Standard_Boolean tryC2)
|
||||
{
|
||||
thetryc2 = tryC2; thefound = Standard_False;
|
||||
}
|
||||
|
||||
Standard_Boolean IGESSelect_SplineToBSpline::OptionTryC2 () const
|
||||
{
|
||||
return thetryc2;
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean IGESSelect_SplineToBSpline::Perform
|
||||
(const Interface_Graph& G, const Handle(Interface_Protocol)&,
|
||||
Interface_CheckIterator& checks,
|
||||
Handle(Interface_InterfaceModel)& newmod)
|
||||
{
|
||||
Standard_Integer nbe = G.Size();
|
||||
thefound = Standard_False;
|
||||
themap.Nullify();
|
||||
for (Standard_Integer i = 1; i <= nbe; i ++) {
|
||||
DeclareAndCast(IGESData_IGESEntity,ent,G.Entity(i));
|
||||
if (ent.IsNull()) continue;
|
||||
Standard_Integer it = ent->TypeNumber();
|
||||
if (it == 112 || it == 126) {
|
||||
thefound = Standard_True;
|
||||
#ifdef DEB
|
||||
cout<<"IGESSelect_SplineToBSpline : n0."<<i
|
||||
<< (it == 112 ? ", Curve" : ", Surface")<<" to convert"<<endl;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
newmod.Nullify();
|
||||
if (!thefound) return Standard_True;
|
||||
|
||||
// Il faudrait convertir ...
|
||||
checks.CCheck(0)->AddFail("IGESSelect_SplineToBSpline : not yet implemented");
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean IGESSelect_SplineToBSpline::Updated
|
||||
(const Handle(Standard_Transient)& entfrom,
|
||||
Handle(Standard_Transient)& entto) const
|
||||
{
|
||||
if (!thefound) {
|
||||
entto = entfrom;
|
||||
return Standard_True;
|
||||
}
|
||||
if (themap.IsNull()) return Standard_False;
|
||||
return themap->Search(entfrom,entto);
|
||||
}
|
||||
|
||||
|
||||
TCollection_AsciiString IGESSelect_SplineToBSpline::Label () const
|
||||
{
|
||||
if (thetryc2) return TCollection_AsciiString
|
||||
("Convert Spline Forms to BSpline, trying to recover C1-C2 continuity");
|
||||
else return TCollection_AsciiString ("Convert Spline Forms to BSpline");
|
||||
}
|
34
src/IGESSelect/IGESSelect_UpdateCreationDate.cdl
Executable file
34
src/IGESSelect/IGESSelect_UpdateCreationDate.cdl
Executable file
@@ -0,0 +1,34 @@
|
||||
-- File: IGESSelect_UpdateCreationDate.cdl
|
||||
-- Created: Wed Jun 1 16:19:53 1994
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@bravox>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
class UpdateCreationDate from IGESSelect inherits ModelModifier from IGESSelect
|
||||
|
||||
---Purpose : Allows to Change the Creation Date indication in the Header
|
||||
-- (Global Section) of IGES File. It is taken from the operating
|
||||
-- system (time of application of the Modifier).
|
||||
-- The Selection of the Modifier is not used : it simply acts as
|
||||
-- a criterium to select IGES Files to touch up
|
||||
|
||||
uses AsciiString from TCollection,
|
||||
IGESModel, CopyTool, ContextModif
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable UpdateCreationDate;
|
||||
---Purpose : Creates an UpdateCreationDate, which uses the system Date
|
||||
|
||||
Performing (me; ctx : in out ContextModif;
|
||||
target : mutable IGESModel;
|
||||
TC : in out CopyTool);
|
||||
---Purpose : Specific action : only <target> is used : the system Date
|
||||
-- is set to Global Section Item n0 18.
|
||||
|
||||
Label (me) returns AsciiString from TCollection;
|
||||
---Purpose : Returns a text which is
|
||||
-- "Update IGES Header Creation Date"
|
||||
|
||||
end UpdateCreationDate;
|
41
src/IGESSelect/IGESSelect_UpdateCreationDate.cxx
Executable file
41
src/IGESSelect/IGESSelect_UpdateCreationDate.cxx
Executable file
@@ -0,0 +1,41 @@
|
||||
//#65 rln 12.02.99 S4151 (explicitly force YYMMDD.HHMMSS before Y2000 and YYYYMMDD.HHMMSS after Y2000)
|
||||
#include <IGESSelect_UpdateCreationDate.ixx>
|
||||
#include <OSD_Process.hxx>
|
||||
#include <Quantity_Date.hxx>
|
||||
#include <IGESData_GlobalSection.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
#include <Interface_Check.hxx>
|
||||
|
||||
|
||||
|
||||
IGESSelect_UpdateCreationDate::IGESSelect_UpdateCreationDate ()
|
||||
: IGESSelect_ModelModifier (Standard_False) { }
|
||||
|
||||
void IGESSelect_UpdateCreationDate::Performing
|
||||
(IFSelect_ContextModif& ctx,
|
||||
const Handle(IGESData_IGESModel)& target,
|
||||
Interface_CopyTool& ) const
|
||||
{
|
||||
Standard_Integer jour,mois,annee,heure,minute,seconde,millisec,microsec;
|
||||
OSD_Process system;
|
||||
Quantity_Date ladate = system.SystemDate();
|
||||
ladate.Values (mois,jour,annee,heure,minute,seconde,millisec,microsec);
|
||||
|
||||
IGESData_GlobalSection GS = target->GlobalSection();
|
||||
if (annee < 2000)
|
||||
//#65 rln 12.02.99 S4151 (explicitly force YYMMDD.HHMMSS before Y2000)
|
||||
GS.SetDate (IGESData_GlobalSection::NewDateString
|
||||
(annee,mois,jour,heure,minute,seconde,0));
|
||||
else
|
||||
//#65 rln 12.02.99 S4151 (explicitly force YYYYMMDD.HHMMSS after Y2000)
|
||||
GS.SetDate (IGESData_GlobalSection::NewDateString
|
||||
(annee,mois,jour,heure,minute,seconde, -1));
|
||||
target->SetGlobalSection(GS);
|
||||
Handle(Interface_Check) check = new Interface_Check;
|
||||
target->VerifyCheck(check);
|
||||
ctx.AddCheck(check);
|
||||
}
|
||||
|
||||
|
||||
TCollection_AsciiString IGESSelect_UpdateCreationDate::Label () const
|
||||
{ return TCollection_AsciiString ("Update Creation Date in IGES Global Section"); }
|
36
src/IGESSelect/IGESSelect_UpdateFileName.cdl
Executable file
36
src/IGESSelect/IGESSelect_UpdateFileName.cdl
Executable file
@@ -0,0 +1,36 @@
|
||||
-- File: IGESSelect_UpdateFileName.cdl
|
||||
-- Created: Thu Feb 23 18:36:47 1995
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@bravox>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
class UpdateFileName from IGESSelect inherits ModelModifier from IGESSelect
|
||||
|
||||
---Purpose : Sets the File Name in Header to be the actual name of the file
|
||||
-- If new file name is unknown, the former one is kept
|
||||
-- Remark : this works well only when it is Applied and send time
|
||||
-- If it is run immediately, new file name is unknown and nothing
|
||||
-- is done
|
||||
-- The Selection of the Modifier is not used : it simply acts as
|
||||
-- a criterium to select IGES Files to touch up
|
||||
|
||||
uses AsciiString from TCollection,
|
||||
IGESModel, CopyTool, ContextModif
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable UpdateFileName;
|
||||
---Purpose : Creates an UpdateFileName, which uses the system Date
|
||||
|
||||
Performing (me; ctx : in out ContextModif;
|
||||
target : mutable IGESModel;
|
||||
TC : in out CopyTool);
|
||||
---Purpose : Specific action : only <target> is used : the system Date
|
||||
-- is set to Global Section Item n0 18.
|
||||
|
||||
Label (me) returns AsciiString from TCollection;
|
||||
---Purpose : Returns a text which is
|
||||
-- "Updates IGES File Name to new current one"
|
||||
|
||||
end UpdateFileName;
|
27
src/IGESSelect/IGESSelect_UpdateFileName.cxx
Executable file
27
src/IGESSelect/IGESSelect_UpdateFileName.cxx
Executable file
@@ -0,0 +1,27 @@
|
||||
#include <IGESSelect_UpdateFileName.ixx>
|
||||
#include <IGESData_GlobalSection.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
#include <Interface_Check.hxx>
|
||||
|
||||
|
||||
IGESSelect_UpdateFileName::IGESSelect_UpdateFileName ()
|
||||
: IGESSelect_ModelModifier (Standard_False) { }
|
||||
|
||||
void IGESSelect_UpdateFileName::Performing
|
||||
(IFSelect_ContextModif& ctx, const Handle(IGESData_IGESModel)& target,
|
||||
Interface_CopyTool& TC) const
|
||||
{
|
||||
if (!ctx.HasFileName()) {
|
||||
ctx.CCheck(0)->AddWarning("New File Name unknown, former one is kept");
|
||||
return;
|
||||
}
|
||||
IGESData_GlobalSection GS = target->GlobalSection();
|
||||
GS.SetFileName (new TCollection_HAsciiString (ctx.FileName()) );
|
||||
target->SetGlobalSection(GS);
|
||||
Handle(Interface_Check) check = new Interface_Check;
|
||||
target->VerifyCheck(check);
|
||||
ctx.AddCheck(check);
|
||||
}
|
||||
|
||||
TCollection_AsciiString IGESSelect_UpdateFileName::Label () const
|
||||
{ return TCollection_AsciiString("Updates IGES File Name to new current one"); }
|
37
src/IGESSelect/IGESSelect_UpdateLastChange.cdl
Executable file
37
src/IGESSelect/IGESSelect_UpdateLastChange.cdl
Executable file
@@ -0,0 +1,37 @@
|
||||
-- File: IGESSelect_UpdateLastChange.cdl
|
||||
-- Created: Wed Jun 1 16:19:53 1994
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@bravox>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
class UpdateLastChange from IGESSelect inherits ModelModifier from IGESSelect
|
||||
|
||||
---Purpose : Allows to Change the Last Change Date indication in the Header
|
||||
-- (Global Section) of IGES File. It is taken from the operating
|
||||
-- system (time of application of the Modifier).
|
||||
-- The Selection of the Modifier is not used : it simply acts as
|
||||
-- a criterium to select IGES Files to touch up.
|
||||
-- Remark : IGES Models noted as version before IGES 5.1 are in
|
||||
-- addition changed to 5.1
|
||||
|
||||
uses AsciiString from TCollection,
|
||||
IGESModel, CopyTool, ContextModif
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable UpdateLastChange;
|
||||
---Purpose : Creates an UpdateLastChange, which uses the system Date
|
||||
|
||||
Performing (me; ctx : in out ContextModif;
|
||||
target : mutable IGESModel;
|
||||
TC : in out CopyTool);
|
||||
---Purpose : Specific action : only <target> is used : the system Date
|
||||
-- is set to Global Section Item n0 25. Also sets IGES Version
|
||||
-- (Item n0 23) to IGES5 if it was older.
|
||||
|
||||
Label (me) returns AsciiString from TCollection;
|
||||
---Purpose : Returns a text which is
|
||||
-- "Update IGES Header Last Change Date"
|
||||
|
||||
end UpdateLastChange;
|
42
src/IGESSelect/IGESSelect_UpdateLastChange.cxx
Executable file
42
src/IGESSelect/IGESSelect_UpdateLastChange.cxx
Executable file
@@ -0,0 +1,42 @@
|
||||
//#65 rln 12.02.99 S4151 (explicitly force YYMMDD.HHMMSS before Y2000 and YYYYMMDD.HHMMSS after Y2000)
|
||||
#include <IGESSelect_UpdateLastChange.ixx>
|
||||
#include <OSD_Process.hxx>
|
||||
#include <Quantity_Date.hxx>
|
||||
#include <IGESData_GlobalSection.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
#include <Interface_Check.hxx>
|
||||
|
||||
|
||||
|
||||
IGESSelect_UpdateLastChange::IGESSelect_UpdateLastChange ()
|
||||
: IGESSelect_ModelModifier (Standard_False) { }
|
||||
|
||||
void IGESSelect_UpdateLastChange::Performing
|
||||
(IFSelect_ContextModif& ctx,
|
||||
const Handle(IGESData_IGESModel)& target,
|
||||
Interface_CopyTool& ) const
|
||||
{
|
||||
Standard_Integer jour,mois,annee,heure,minute,seconde,millisec,microsec;
|
||||
OSD_Process system;
|
||||
Quantity_Date ladate = system.SystemDate();
|
||||
ladate.Values (mois,jour,annee,heure,minute,seconde,millisec,microsec);
|
||||
|
||||
IGESData_GlobalSection GS = target->GlobalSection();
|
||||
if (GS.IGESVersion() < 9) GS.SetIGESVersion(9);
|
||||
if (annee < 2000)
|
||||
//#65 rln 12.02.99 S4151 (explicitly force YYMMDD.HHMMSS before Y2000)
|
||||
GS.SetDate (IGESData_GlobalSection::NewDateString
|
||||
(annee,mois,jour,heure,minute,seconde,0));
|
||||
else
|
||||
//#65 rln 12.02.99 S4151 (explicitly force YYYYMMDD.HHMMSS after Y2000)
|
||||
GS.SetDate (IGESData_GlobalSection::NewDateString
|
||||
(annee,mois,jour,heure,minute,seconde, -1));
|
||||
target->SetGlobalSection(GS);
|
||||
Handle(Interface_Check) check = new Interface_Check;
|
||||
target->VerifyCheck(check);
|
||||
ctx.AddCheck(check);
|
||||
}
|
||||
|
||||
|
||||
TCollection_AsciiString IGESSelect_UpdateLastChange::Label () const
|
||||
{ return TCollection_AsciiString ("Update Last Change Date in IGES Global Section"); }
|
106
src/IGESSelect/IGESSelect_ViewSorter.cdl
Executable file
106
src/IGESSelect/IGESSelect_ViewSorter.cdl
Executable file
@@ -0,0 +1,106 @@
|
||||
-- File: IGESSelect_ViewSorter.cdl
|
||||
-- Created: Tue May 31 14:56:09 1994
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@bravox>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
class ViewSorter from IGESSelect inherits TShared
|
||||
|
||||
---Purpose : Sorts IGES Entities on the views and drawings.
|
||||
-- In a first step, it splits a set of entities according the
|
||||
-- different views they are attached to.
|
||||
-- Then, packets according single views (+ drawing frames), or
|
||||
-- according drawings (which refer to the views) can be determined
|
||||
--
|
||||
-- It is a TShared, hence it can be a workomg field of a non-
|
||||
-- mutable object (a Dispatch for instance)
|
||||
|
||||
uses Transient, HSequenceOfTransient,
|
||||
IndexedMapOfTransient, SequenceOfInteger,
|
||||
EntityIterator, InterfaceModel, Graph,
|
||||
PacketList, IGESEntity, IGESModel
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable ViewSorter;
|
||||
---Purpose : Creates a ViewSorter, empty. SetModel remains to be called
|
||||
|
||||
SetModel (me : mutable; model : IGESModel);
|
||||
---Purpose : Sets the Model (for PacketList)
|
||||
|
||||
Clear (me : mutable);
|
||||
---Purpose : Clears recorded data
|
||||
|
||||
Add (me : mutable; ent : any Transient) returns Boolean;
|
||||
---Purpose : Adds an item according its type : AddEntity,AddList,AddModel
|
||||
|
||||
AddEntity (me : mutable; igesent : any IGESEntity) returns Boolean;
|
||||
---Purpose : Adds an IGES entity. Records the view it is attached to.
|
||||
-- Records directly <ent> if it is a ViewKindEntity or a Drawing
|
||||
-- Returns True if added, False if already in the map
|
||||
|
||||
AddList (me : mutable; list : HSequenceOfTransient);
|
||||
---Purpose : Adds a list of entities by adding each of the items
|
||||
|
||||
AddModel (me : mutable; model : InterfaceModel);
|
||||
---Purpose : Adds all the entities contained in a Model
|
||||
|
||||
NbEntities (me) returns Integer;
|
||||
---Purpose : Returns the count of already recorded
|
||||
|
||||
-- Preparations --
|
||||
|
||||
SortSingleViews (me : mutable; alsoframes : Boolean);
|
||||
---Purpose : Prepares the result to keep only sets attached to Single Views
|
||||
-- If <alsoframes> is given True, it keeps also the Drawings as
|
||||
-- specific sets, in order to get their frames.
|
||||
-- Entities attached to no single view are put in Remaining List.
|
||||
--
|
||||
-- Result can then be read by the methods NbSets,SetItem,SetList,
|
||||
-- RemainingList(final = True)
|
||||
|
||||
SortDrawings (me : mutable; G : Graph);
|
||||
---Purpose : Prepares the result to the sets attached to Drawings :
|
||||
-- All the single views referenced by a Drawing become bound to
|
||||
-- the set for this Drawing
|
||||
--
|
||||
-- Entities or Views which correspond to no Drawing are put into
|
||||
-- the Remaining List.
|
||||
--
|
||||
-- Result can then be read by the methods NbSets,SetItem,SetList,
|
||||
-- RemainingList(final = True)
|
||||
|
||||
-- Queries --
|
||||
|
||||
NbSets (me; final : Boolean) returns Integer;
|
||||
---Purpose : Returns the count of sets recorded, one per distinct item.
|
||||
-- The Remaining List is not counted.
|
||||
-- If <final> is False, the sets are attached to distinct views
|
||||
-- determined by the method Add.
|
||||
-- If <final> is True, they are the sets determined by the last
|
||||
-- call to, either SortSingleViews, or SortDrawings.
|
||||
--
|
||||
-- Warning : Drawings directly recorded are also counted as sets, because
|
||||
-- of their Frame (which is made of Annotations)
|
||||
|
||||
SetItem (me; num : Integer; final : Boolean) returns any IGESEntity;
|
||||
---Purpose : Returns the Item which is attached to a set of entities
|
||||
-- For <final> and definition of sets, see method NbSets.
|
||||
-- This item can be a kind of View or a Drawing
|
||||
|
||||
Sets (me; final : Boolean) returns PacketList;
|
||||
---Purpose : Returns the complete content of the determined Sets, which
|
||||
-- include Duplicated and Remaining (duplication 0) lists
|
||||
-- For <final> and definition of sets, see method NbSets.
|
||||
|
||||
fields
|
||||
|
||||
themodel : IGESModel;
|
||||
themap : IndexedMapOfTransient;
|
||||
theitems : IndexedMapOfTransient;
|
||||
thefinals : IndexedMapOfTransient;
|
||||
theinditem : SequenceOfInteger;
|
||||
theindfin : SequenceOfInteger;
|
||||
|
||||
end ViewSorter;
|
198
src/IGESSelect/IGESSelect_ViewSorter.cxx
Executable file
198
src/IGESSelect/IGESSelect_ViewSorter.cxx
Executable file
@@ -0,0 +1,198 @@
|
||||
#include <IGESSelect_ViewSorter.ixx>
|
||||
#include <IGESData_IGESEntity.hxx>
|
||||
#include <IGESData_ViewKindEntity.hxx>
|
||||
#include <Interface_EntityIterator.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
|
||||
|
||||
|
||||
#define PourDrawing 404
|
||||
|
||||
|
||||
IGESSelect_ViewSorter::IGESSelect_ViewSorter () { }
|
||||
|
||||
void IGESSelect_ViewSorter::SetModel
|
||||
(const Handle(IGESData_IGESModel)& model) { themodel = model; }
|
||||
|
||||
|
||||
void IGESSelect_ViewSorter::Clear ()
|
||||
{
|
||||
Standard_Integer nb = themodel->NbEntities();
|
||||
if (nb < 100) nb = 100;
|
||||
themap.Clear(); themap.ReSize (nb);
|
||||
theitems.Clear(); theitems.ReSize (nb);
|
||||
thefinals.Clear(); thefinals.ReSize (nb);
|
||||
theinditem.Clear(); theindfin.Clear(); // seq//
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean IGESSelect_ViewSorter::Add
|
||||
(const Handle(Standard_Transient)& ent)
|
||||
{
|
||||
DeclareAndCast(IGESData_IGESEntity,igesent,ent);
|
||||
if (!igesent.IsNull()) return AddEntity (igesent);
|
||||
DeclareAndCast(TColStd_HSequenceOfTransient,list,ent);
|
||||
if (!list.IsNull()) { AddList (list); return Standard_True; }
|
||||
DeclareAndCast(Interface_InterfaceModel,model,ent);
|
||||
if (!model.IsNull()) { AddModel (model); return Standard_True; }
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
Standard_Boolean IGESSelect_ViewSorter::AddEntity
|
||||
(const Handle(IGESData_IGESEntity)& igesent)
|
||||
{
|
||||
// Reception, controle de type et de map
|
||||
if (igesent.IsNull()) return Standard_False;
|
||||
if (themap.FindIndex(igesent)) return Standard_False;
|
||||
themap.Add(igesent);
|
||||
// Recuperation de la vue (attention au cas du Drawing)
|
||||
Handle(IGESData_IGESEntity) view;
|
||||
if (igesent->TypeNumber() == PourDrawing) view = igesent; // DRAWING
|
||||
else {
|
||||
if (igesent->IsKind(STANDARD_TYPE(IGESData_ViewKindEntity))) view = igesent; // VIEW
|
||||
else view = igesent->View();
|
||||
/*
|
||||
DeclareAndCast(IGESData_ViewKindEntity,trueview,view);
|
||||
if (!trueview.IsNull())
|
||||
if (trueview->IsSingle()) view.Nullify(); // Multiple -> Nulle
|
||||
*/
|
||||
}
|
||||
// On enregistre
|
||||
Standard_Integer viewindex = 0; // 0 sera pour remain
|
||||
if (!view.IsNull()) {
|
||||
viewindex = theitems.FindIndex(view);
|
||||
if (viewindex <= 0) viewindex = theitems.Add(view);
|
||||
}
|
||||
theinditem.Append(viewindex);
|
||||
theindfin.Append(0);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
void IGESSelect_ViewSorter::AddList
|
||||
(const Handle(TColStd_HSequenceOfTransient)& list)
|
||||
{
|
||||
Standard_Integer nb = list->Length();
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) Add (list->Value(i));
|
||||
}
|
||||
|
||||
void IGESSelect_ViewSorter::AddModel
|
||||
(const Handle(Interface_InterfaceModel)& model)
|
||||
{
|
||||
DeclareAndCast(IGESData_IGESModel,igesmod,model);
|
||||
if (igesmod.IsNull()) return;
|
||||
Standard_Integer nb = igesmod->NbEntities();
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) AddEntity (igesmod->Entity(i));
|
||||
}
|
||||
|
||||
Standard_Integer IGESSelect_ViewSorter::NbEntities () const
|
||||
{ return themap.Extent(); }
|
||||
|
||||
// ..... Attention .....
|
||||
|
||||
void IGESSelect_ViewSorter::SortSingleViews
|
||||
(const Standard_Boolean alsoframes)
|
||||
{
|
||||
// Du tas initial, on ecarte : les vues nulles, et selon alsoframe les drawings
|
||||
// Vues nulles : cf theremain (remain initial reconduit)
|
||||
|
||||
// Remarque : le filtre IsSingle a ete applique par Add
|
||||
thefinals.Clear();
|
||||
Standard_Integer nb = theinditem.Length();
|
||||
//Standard_Integer numit = 0; //szv#4:S4163:12Mar99 not needed
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) {
|
||||
Standard_Integer numitem = theinditem.Value(i);
|
||||
Standard_Integer finalindex = 0; // 0 sera pour remain
|
||||
if (numitem > 0) {
|
||||
//numit = numitem; //szv#4:S4163:12Mar99 not needed
|
||||
DeclareAndCast(IGESData_IGESEntity,item,theitems.FindKey(numitem));
|
||||
Standard_Boolean ok = Standard_False;
|
||||
if (alsoframes) ok = (item->TypeNumber() == PourDrawing);
|
||||
if (!ok) {
|
||||
DeclareAndCast(IGESData_ViewKindEntity,view,item);
|
||||
if (!view.IsNull()) ok = view->IsSingle();
|
||||
}
|
||||
if (ok) {
|
||||
finalindex = thefinals.FindIndex(item);
|
||||
if (finalindex <= 0) finalindex = thefinals.Add(item);
|
||||
}
|
||||
}
|
||||
theindfin.SetValue(i,finalindex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void IGESSelect_ViewSorter::SortDrawings (const Interface_Graph& G)
|
||||
{
|
||||
// Pour chaque item (vue ou drawing), drawing contenant, silya (sinon tant pis)
|
||||
|
||||
thefinals.Clear();
|
||||
Standard_Integer nb = theinditem.Length();
|
||||
//Standard_Integer numit = 0; //szv#4:S4163:12Mar99 not needed
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) {
|
||||
Standard_Integer numitem = theinditem.Value(i);
|
||||
Standard_Integer finalindex = 0; // 0 sera pour remain
|
||||
if (numitem > 0) {
|
||||
//numit = numitem; //szv#4:S4163:12Mar99 not needed
|
||||
DeclareAndCast(IGESData_IGESEntity,item,theitems.FindKey(numitem));
|
||||
if (item.IsNull()) continue;
|
||||
// Si cest un Drawing, il definit le Set. Sinon, chercher Drawing contenant
|
||||
Handle(Standard_Transient) drawing;
|
||||
if (item->TypeNumber() == PourDrawing) drawing = item;
|
||||
else {
|
||||
Interface_EntityIterator list = G.Sharings(item);
|
||||
for (list.Start(); list.More(); list.Next()) {
|
||||
DeclareAndCast(IGESData_IGESEntity,draw,list.Value());
|
||||
if (draw.IsNull()) continue;
|
||||
if (draw->TypeNumber() == PourDrawing) drawing = draw;
|
||||
}
|
||||
}
|
||||
if (!drawing.IsNull()) {
|
||||
finalindex = thefinals.FindIndex(drawing);
|
||||
if (finalindex <= 0) finalindex = thefinals.Add(drawing);
|
||||
}
|
||||
}
|
||||
theindfin.SetValue(i,finalindex);
|
||||
}
|
||||
}
|
||||
|
||||
// .... Queries ....
|
||||
|
||||
Standard_Integer IGESSelect_ViewSorter::NbSets
|
||||
(const Standard_Boolean final) const
|
||||
{
|
||||
if (final) return thefinals.Extent();
|
||||
else return theitems.Extent();
|
||||
}
|
||||
|
||||
Handle(IGESData_IGESEntity) IGESSelect_ViewSorter::SetItem
|
||||
(const Standard_Integer num, const Standard_Boolean final) const
|
||||
{
|
||||
if (final) return GetCasted(IGESData_IGESEntity,thefinals.FindKey(num));
|
||||
else return GetCasted(IGESData_IGESEntity,theitems.FindKey(num));
|
||||
}
|
||||
|
||||
Handle(IFSelect_PacketList) IGESSelect_ViewSorter::Sets
|
||||
(const Standard_Boolean final) const
|
||||
{
|
||||
Handle(IFSelect_PacketList) list = new IFSelect_PacketList(themodel);
|
||||
Standard_Integer i, nb;
|
||||
nb = (final ? theindfin.Length() : theinditem.Length());
|
||||
Standard_Integer nbs = NbSets(final);
|
||||
for (Standard_Integer num = 1; num <= nbs; num ++) {
|
||||
list->AddPacket();
|
||||
if (final) {
|
||||
// Attention a l unicite
|
||||
for (i = 1; i <= nb; i ++) {
|
||||
if (theindfin.Value(i) != num) continue;
|
||||
list->Add (themap.FindKey(i));
|
||||
}
|
||||
} else {
|
||||
for (i = 1; i <= nb; i ++) {
|
||||
if (theinditem.Value(i) != num) continue;
|
||||
list->Add (themap.FindKey(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
53
src/IGESSelect/IGESSelect_WorkLibrary.cdl
Executable file
53
src/IGESSelect/IGESSelect_WorkLibrary.cdl
Executable file
@@ -0,0 +1,53 @@
|
||||
-- File: IGESSelect_WorkLibrary.cdl
|
||||
-- Created: Fri Jun 3 09:33:18 1994
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@sdsun1>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
class WorkLibrary from IGESSelect inherits WorkLibrary from IFSelect
|
||||
|
||||
---Purpose : Performs Read and Write an IGES File with an IGES Model
|
||||
|
||||
uses CString, Transient,
|
||||
InterfaceModel, Protocol from Interface, CheckIterator, ContextWrite,
|
||||
Messenger from Message,
|
||||
Protocol from IGESData
|
||||
|
||||
is
|
||||
|
||||
Create (modefnes : Boolean = Standard_False)
|
||||
returns mutable WorkLibrary from IGESSelect;
|
||||
---Purpose : Creates a IGES WorkLibrary
|
||||
-- If <modefnes> is given as True, it will work for FNES
|
||||
|
||||
ReadFile (me; name : CString;
|
||||
model : out mutable InterfaceModel;
|
||||
protocol : Protocol from Interface)
|
||||
returns Integer;
|
||||
---Purpose : Reads a IGES File and returns a IGES Model (into <mod>),
|
||||
-- or lets <mod> "Null" in case of Error
|
||||
-- Returns 0 if OK, 1 if Read Error, -1 if File not opened
|
||||
|
||||
WriteFile (me; ctx : in out ContextWrite) returns Boolean;
|
||||
---Purpose : Writes a File from a IGES Model (brought by <ctx>)
|
||||
-- Returns False (and writes no file) if <ctx> is not for IGES
|
||||
|
||||
DefineProtocol (myclass) returns Protocol from IGESData;
|
||||
---Purpose : Defines a protocol to be adequate for IGES
|
||||
-- (encompasses ALL the IGES norm including IGESSolid, IGESAppli)
|
||||
|
||||
DumpEntity (me;
|
||||
model : InterfaceModel;
|
||||
protocol : Protocol from Interface;
|
||||
entity : Transient;
|
||||
S : Messenger from Message;
|
||||
level : Integer);
|
||||
---Purpose : Dumps an IGES Entity with an IGES Dumper. <level> is the one
|
||||
-- used by IGESDumper.
|
||||
|
||||
fields
|
||||
|
||||
themodefnes : Boolean;
|
||||
|
||||
end WorkLibrary;
|
180
src/IGESSelect/IGESSelect_WorkLibrary.cxx
Executable file
180
src/IGESSelect/IGESSelect_WorkLibrary.cxx
Executable file
@@ -0,0 +1,180 @@
|
||||
|
||||
#include <Standard_Stream.hxx>
|
||||
|
||||
#include <IGESSelect_WorkLibrary.ixx>
|
||||
#include <Standard_ErrorHandler.hxx>
|
||||
#include <Message_Messenger.hxx>
|
||||
#include <Message.hxx>
|
||||
|
||||
#include <IGESSolid.hxx>
|
||||
#include <IGESAppli.hxx>
|
||||
#include <IGESDefs.hxx>
|
||||
|
||||
#include <IGESData_IGESWriter.hxx>
|
||||
#include <IGESData_IGESModel.hxx>
|
||||
#include <IGESData_Protocol.hxx>
|
||||
#include <IGESData_FileProtocol.hxx>
|
||||
#include <IGESFile_Read.hxx>
|
||||
#include <IGESSelect_Dumper.hxx>
|
||||
#include <IFSelect_GeneralModifier.hxx>
|
||||
#include <TColStd_HSequenceOfInteger.hxx>
|
||||
#include <IGESSelect_FileModifier.hxx>
|
||||
|
||||
#include <Interface_ReportEntity.hxx>
|
||||
#include <IGESData_IGESEntity.hxx>
|
||||
#include <IGESData_IGESDumper.hxx>
|
||||
|
||||
#include <Interface_Check.hxx>
|
||||
|
||||
#include <Interface_Macros.hxx>
|
||||
#include <errno.h>
|
||||
|
||||
static int deja = 0;
|
||||
static Handle(IGESData_FileProtocol) IGESProto;
|
||||
|
||||
|
||||
IGESSelect_WorkLibrary::IGESSelect_WorkLibrary
|
||||
(const Standard_Boolean modefnes)
|
||||
: themodefnes (modefnes)
|
||||
{
|
||||
IGESSolid::Init();
|
||||
IGESAppli::Init();
|
||||
IGESDefs::Init();
|
||||
|
||||
if (!deja) {
|
||||
Handle(IGESSelect_Dumper) sesdump = new IGESSelect_Dumper; // ainsi,cestfait
|
||||
deja = 1;
|
||||
}
|
||||
SetDumpLevels (4,6);
|
||||
SetDumpHelp (0,"Only DNum");
|
||||
SetDumpHelp (1,"DNum, IGES Type & Form");
|
||||
SetDumpHelp (2,"Main Directory Informations");
|
||||
SetDumpHelp (3,"Complete Directory Part");
|
||||
SetDumpHelp (4,"Directory + Fields (except list contents)");
|
||||
SetDumpHelp (5,"Complete (with list contents)");
|
||||
SetDumpHelp (6,"Complete + Transformed data");
|
||||
}
|
||||
|
||||
Standard_Integer IGESSelect_WorkLibrary::ReadFile
|
||||
(const Standard_CString name,
|
||||
Handle(Interface_InterfaceModel)& model,
|
||||
const Handle(Interface_Protocol)& protocol) const
|
||||
{
|
||||
Handle(Message_Messenger) sout = Message::DefaultMessenger();
|
||||
Handle(IGESData_IGESModel) igesmod = new IGESData_IGESModel;
|
||||
DeclareAndCast(IGESData_Protocol,prot,protocol);
|
||||
|
||||
char* pname=(char*) name;
|
||||
Standard_Integer status = IGESFile_Read (pname,igesmod,prot);
|
||||
|
||||
if (status < 0) sout<<"File not found : "<<name<<endl;
|
||||
if (status > 0) sout<<"Error when reading file : "<<name<<endl;
|
||||
if (status == 0) model = igesmod;
|
||||
else model.Nullify();
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean IGESSelect_WorkLibrary::WriteFile
|
||||
(IFSelect_ContextWrite& ctx) const
|
||||
{
|
||||
Handle(Message_Messenger) sout = Message::DefaultMessenger();
|
||||
// Preparation
|
||||
DeclareAndCast(IGESData_IGESModel,igesmod,ctx.Model());
|
||||
DeclareAndCast(IGESData_Protocol,prot,ctx.Protocol());
|
||||
|
||||
if (igesmod.IsNull() || prot.IsNull()) return Standard_False;
|
||||
ofstream fout;
|
||||
fout.rdbuf()->open(ctx.FileName(),ios::out );
|
||||
if (!fout) {
|
||||
ctx.CCheck(0)->AddFail("IGES File could not be created");
|
||||
sout<<" - IGES File could not be created : " << ctx.FileName() << endl; return 0;
|
||||
}
|
||||
sout<<" IGES File Name : "<<ctx.FileName();
|
||||
IGESData_IGESWriter VW(igesmod);
|
||||
sout<<"("<<igesmod->NbEntities()<<" ents) ";
|
||||
|
||||
// File Modifiers
|
||||
Standard_Integer nbmod = ctx.NbModifiers();
|
||||
for (Standard_Integer numod = 1; numod <= nbmod; numod ++) {
|
||||
ctx.SetModifier (numod);
|
||||
DeclareAndCast(IGESSelect_FileModifier,filemod,ctx.FileModifier());
|
||||
if (!filemod.IsNull()) filemod->Perform(ctx,VW);
|
||||
// (impressions de mise au point)
|
||||
sout << " .. FileMod." << numod <<" "<< filemod->Label();
|
||||
if (ctx.IsForAll()) sout << " (all model)";
|
||||
else sout << " (" << ctx.NbEntities() << " entities)";
|
||||
// sout << flush;
|
||||
}
|
||||
|
||||
// Envoi
|
||||
VW.SendModel(prot);
|
||||
sout<<" Write ";
|
||||
if (themodefnes) VW.WriteMode() = 10;
|
||||
Standard_Boolean status = VW.Print(fout); sout<<" Done"<<endl;
|
||||
|
||||
errno = 0;
|
||||
fout.close();
|
||||
status = fout.good() && status && !errno;
|
||||
if(errno)
|
||||
sout << strerror(errno) << endl;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
Handle(IGESData_Protocol) IGESSelect_WorkLibrary::DefineProtocol ()
|
||||
{
|
||||
if (!IGESProto.IsNull()) return IGESProto;
|
||||
Handle(IGESData_Protocol) IGESProto1 = IGESSolid::Protocol();
|
||||
Handle(IGESData_Protocol) IGESProto2 = IGESAppli::Protocol();
|
||||
// Handle(IGESData_FileProtocol) IGESProto = new IGESData_FileProtocol;
|
||||
IGESProto = new IGESData_FileProtocol;
|
||||
IGESProto->Add(IGESProto1);
|
||||
IGESProto->Add(IGESProto2);
|
||||
return IGESProto;
|
||||
}
|
||||
|
||||
|
||||
void IGESSelect_WorkLibrary::DumpEntity
|
||||
(const Handle(Interface_InterfaceModel)& model,
|
||||
const Handle(Interface_Protocol)& protocol,
|
||||
const Handle(Standard_Transient)& entity,
|
||||
const Handle(Message_Messenger)& S, const Standard_Integer level) const
|
||||
{
|
||||
DeclareAndCast(IGESData_IGESModel,igesmod,model);
|
||||
DeclareAndCast(IGESData_Protocol,igespro,protocol);
|
||||
DeclareAndCast(IGESData_IGESEntity,igesent,entity);
|
||||
if (igesmod.IsNull() || igespro.IsNull() || igesent.IsNull()) return;
|
||||
Standard_Integer num = igesmod->Number(igesent);
|
||||
if (num == 0) return;
|
||||
|
||||
S<<" --- Entity "<<num;
|
||||
Standard_Boolean iserr = model->IsRedefinedContent(num);
|
||||
Handle(Standard_Transient) con;
|
||||
if (iserr) con = model->ReportEntity(num)->Content();
|
||||
if (entity.IsNull()) { S<<" Null"<<endl; return ; }
|
||||
|
||||
// On attaque le dump : d abord cas de l Erreur
|
||||
if (iserr) {
|
||||
S << " ERRONEOUS, Content, Type cdl : ";
|
||||
if (!con.IsNull()) S << con->DynamicType()->Name();
|
||||
else S << "(undefined)" << endl;
|
||||
igesent = GetCasted(IGESData_IGESEntity,con);
|
||||
con.Nullify();
|
||||
Handle(Interface_Check) check = model->ReportEntity(num)->Check();
|
||||
Interface_CheckIterator chlist;
|
||||
chlist.Add (check,num);
|
||||
chlist.Print (S,igesmod,Standard_False);
|
||||
if (igesent.IsNull()) return;
|
||||
}
|
||||
else S << " Type cdl : " << igesent->DynamicType()->Name();
|
||||
|
||||
IGESData_IGESDumper dump(igesmod,igespro);
|
||||
try {
|
||||
OCC_CATCH_SIGNALS
|
||||
dump.Dump(igesent,S,level,(level-1)/3);
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
S << " ** Dump Interrupt **" << endl;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user