/*!******************************************************************/ /* File: ig9.c */ /* =========== */ /* */ /* This file includes: */ /* */ /* igdlen(); Delete entity */ /* igdlls(); Delete last entity */ /* igdlgp(); Delete named group */ /* trimpm(); Generate TRIM statement */ /* igblnk(); Blank entity */ /* igubal(); Unblank all entities */ /* ightal(); Make all entities hitable */ /* igupcs(); Redisplay currently active coordinate system */ /* */ /* This file is part of the VARKON IG Library. */ /* URL: http://www.varkon.com */ /* */ /* This library is free software; you can redistribute it and/or */ /* modify it under the terms of the GNU Library General Public */ /* License as published by the Free Software Foundation; either */ /* version 2 of the License, or (at your option) any later */ /* version. */ /* */ /* This library is distributed in the hope that it will be */ /* useful, but WITHOUT ANY WARRANTY; without even the implied */ /* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR */ /* PURPOSE. See the GNU Library General Public License for more */ /* details. */ /* */ /* You should have received a copy of the GNU Library General */ /* Public License along with this library; if not, write to the */ /* Free Software Foundation, Inc., 675 Mass Ave, Cambridge, */ /* MA 02139, USA. */ /* */ /* (C)Microform AB 1984-1999, Johan Kjellander, johan@microform.se */ /* */ /********************************************************************/ #include "../../DB/include/DB.h" #include "../../DB/include/DBintern.h" #include "../include/IG.h" #include "../../WP/include/WP.h" #include "../../GP/include/GP.h" #include "../../EX/include/EX.h" #include extern short v3mode,gptrty; #ifdef WIN32 extern short wpupcs(); #endif static short igdlgs(DBId *idvek); static char *mk_dpsimple(V2REFVA *id); static char *mk_dppart(V2REFVA *id); /*!******************************************************/ short igdlen() /* Varkonfunktion för att ta bort en geometrisats * via hårkors. * * In: Inget. * * Ut: Inget. * * FV: 0 = OK, REJECT = avsluta, GOMAIN = huvudmenyn * * (C)microform ab 12/3/86 J. Kjellander * * 5/10/86 GOMAIN, B. Doverud * 18/8/88 getmid(), J. Kjellander * ******************************************************!*/ { short status,nid,i; DBId idmat[IGMAXID][MXINIV]; DBetype typv[IGMAXID]; /* ***Hämta id för någon av storhetens instanser. */ if ( v3mode == RIT_MOD ) { nid = IGMAXID; igptma(146,IG_MESS); } else { nid = 1; igptma(145,IG_MESS); } typv[0] = ALLTYP; status = getmid(idmat,typv,&nid); igrsma(); if ( status < 0 ) goto exit; /* ***Om RITPAK, fråga om OK innan allt försvinner. och ***ta sedan bort allt utan vidare kontroller. */ if ( v3mode == RIT_MOD ) { if ( nid > 0 && igialt(1630,67,68,FALSE) == FALSE ) goto exit; for ( i=0; i 1 ) { if( igialt(372,67,68,TRUE) ) goto blank; else return(0); } /* ***Kolla om parten/storheten är refererad. */ if ( pmamir(idvek) == TRUE ) { if ( ( prtflg && igialt(174,67,68,TRUE)) || (!prtflg && igialt(354,67,68,TRUE)) ) { litval.lit_type = C_INT_VA; litval.lit.int_va = 1; pmclie(&litval,&exnpt); if ( pmchnp(idvek,PMBLANK,exnpt,&retla) < 0 || retla == (pm_ptr)NULL ) goto syserr; EXblk(idvek); return(0); } else return(0); } /* ***Storheten/parten är inte refererad, ta bort ***ur GM och PM. Om det är en enskild storhet har vi ännu ***inte pratat något, gör det. */ if ( !prtflg && igials(mk_dpsimple(idvek),iggtts(67), iggtts(68),FALSE) == FALSE ) return(0); EXdel(idvek); if ( pmdges(idvek) < 0 ) goto syserr; return(0); /* ***Blankning. */ blank: litval.lit_type = C_REF_VA; litval.lit.ref_va[0].seq_val = idvek[0].seq_val; litval.lit.ref_va[0].ord_val = idvek[0].ord_val; litval.lit.ref_va[0].p_nextre = idvek[0].p_nextre; pmclie(&litval,&exnpt); pmtcon(exnpt,(pm_ptr)NULL,&valparam,&dummy); if ( igcprs("BLANK",valparam) < 0 ) goto syserr; return(0); /* ***Felutgång. */ syserr: erpush("IG3523",""); errmes(); return(0); } /********************************************************/ /*!******************************************************/ short igdlls() /* Tar bort sista satsen i PM. * * In: Inget. * * Ut: Inget. * * FV: Inget. * * (C)microform ab 10/1/85 J. Kjellander * * 6/9/85 Felhantering, B. Doverud * ******************************************************!*/ { /* ***Stryk sista satsen ur PM. */ if ( pmdlst() < 0 ) { erpush("IG3523",""); errmes(); } return(0); } /********************************************************/ /*!******************************************************/ short igdlgp() /* Varkonfunktion för att ta bort grupp via namn. * Om flera grupper med samma namn fins i GM tas * bara den första bort. * * In: Inget. * * Ut: Inget. * * FV: 0 = OK, REJECT = avsluta, GOMAIN = huvudmenyn * * Felkoder: IG3542 = Gruppen finns ej * * (C)microform ab 5/9/85 J. Kjellander * * 5/11/85 Felhantering, J. Kjellander * 1/2/86 EXdel(), J. Kjellander * 13/3/86 igdlgs(), J. Kjellander * 5/10/86 GOMAIN, B. Doverud * ******************************************************!*/ { DBId id[MXINIV]; GMGRP grupp; DBptr lavek[GMMXGP]; DBptr la; DBetype typ; char grpnam[GMGNLN+1]; short ndel = 0,status; /* ***Läs in gruppnamn. */ igptma(318,IG_INP); if ( (status=igssip(iggtts(267),grpnam,"",GMGNLN)) < 0 ) goto exit; /* ***Hämta LA och typ för huvud-parten. */ DBget_pointer('F',id,&la,&typ); /* ***Leta rätt på la för första gruppen med angivet namn i den aktiva parten och ta bort den. */ while ( DBget_pointer('N',id,&la,&typ) == 0 ) { if ( typ == GRPTYP ) { DBread_group(&grupp,lavek,la); if ( strcmp(grpnam,grupp.name_gp) == 0 ) { DBget_id(la,id); id[0].seq_val = abs(id[0].seq_val); igdlgs(id); ++ndel; break; } } } /* ***Om ingen grupp med angivet namn fanns, felmeddelande. */ if (ndel == 0) { erpush("IG3542",""); errmes(); } /* ***Slut. */ exit: igrsma(); return(status); } /********************************************************/ /*!******************************************************/ short trimpm() /* Varkonfunktion för skapa TRIM-sats. * * In: Inget. * * Ut: Inget. * * FV: 0 = OK, REJECT = avsluta, GOMAIN = huvudmenyn * * Felkoder: IG5023 = Kan ej skapa TRIM-sats * * (C)microform ab 15/3/86 J. Kjellander * * 20/3/86 Anrop till pmtcon pmclie, B. Doverud * 24/3/86 Felutgångar, B. Doverud * 31/3/86 UNBLANK, J. Kjellander * 5/10/86 GOMAIN, B. Doverud * 20/11/89 Neg. intnr, J. Kjellander * ******************************************************!*/ { pm_ptr valparam,dummy; pm_ptr exnpt1,exnpt2,exnpt3,exnpt4,retla; DBetype typ1,typ2; bool end,right; short status; PMLITVA litval; DBId id[MXINIV]; char istr[V3STRLEN+1]; /* ***Skapa referens till storhet som skall trimmas. */ start: igptma(352,IG_MESS); typ1 = LINTYP+ARCTYP; if ( (status=getidt(id,&typ1,&end,&right,(short)0)) < 0 ) goto exit; igrsma(); litval.lit_type = C_REF_VA; litval.lit.ref_va[0].seq_val = id[0].seq_val; litval.lit.ref_va[0].ord_val = id[0].ord_val; litval.lit.ref_va[0].p_nextre = id[0].p_nextre; pmclie(&litval,&exnpt1); /* ***Ände. */ litval.lit_type = C_INT_VA; if ( end ) litval.lit.int_va = 1; else litval.lit.int_va = 0; pmclie(&litval,&exnpt2); /* ***Skapa referens till storhet mot vilken trimmning skall ske. */ typ2 = LINTYP+ARCTYP+CURTYP; if ( (status=genref (353,&typ2,&exnpt3,&end,&right)) < 0 ) goto exit; igrsma(); /* ***Om skärning linje/linje, alt = -1. */ if ( typ1 == LINTYP && typ2 == LINTYP ) { litval.lit_type = C_INT_VA; litval.lit.int_va = -1; pmclie( &litval, &exnpt4); } /* ***Annars läs in alternativ. */ else { if ( (status=genint(327,"1",istr,&exnpt4)) < 0 ) goto exit; } /* ***Skapa listan med obligatoriska parametrar. */ pmtcon(exnpt1,(pm_ptr)NULL,&retla,&dummy); pmtcon(exnpt2,retla,&retla,&dummy); pmtcon(exnpt3,retla,&retla,&dummy); pmtcon(exnpt4,retla,&valparam,&dummy); /* ***Skapa, interpretera och länka in satsen i modulen. */ if ( igcprs("TRIM",valparam) < 0 ) { erpush("IG5023","TRIM"); goto errend; } /* ***Om storheten inte ingår i en part, skapa ***UNBLANK-anrop, exnpt1 = storhetens id. */ if ( id[0].p_nextre == NULL ) { pmtcon(exnpt1,(pm_ptr)NULL,&valparam,&dummy); igcprs("UNBLANK",valparam); /* ***och blanka storheten när den skapas. */ litval.lit_type = C_INT_VA; litval.lit.int_va = 1; pmclie(&litval,&exnpt1); pmchnp(id,PMBLANK,exnpt1,&retla); } gphgal(0); goto start; /* ***Slut. */ exit: igrsma(); gphgal(0); return(status); /* ***Felutgång. */ errend: gphgal(0); errmes(); goto start; } /********************************************************/ /*!******************************************************/ short igblnk() /* Varkonfunktion för att släcka en storhet. * * In: Inget. * * Ut: Inget. * * FV: 0 => OK * REJECT => Avsluta * GOMAIN => Huvudmenyn * * (C)microform ab 2/3/88 J. Kjellander * ******************************************************!*/ { short status,nid,i; DBetype typvek[IGMAXID]; DBId idmat[IGMAXID][MXINIV]; /* ***Hämta identitet. */ igptma(149,IG_MESS); typvek[0] = ALLTYP; nid = IGMAXID; status=getmid(idmat,typvek,&nid); igrsma(); if (status < 0 ) return(status); /* ***Blanka storheten. */ for ( i=0; i