 |
Bsoft
2.1.0
Bernard's software package
|
Go to the documentation of this file.
35 for ( sp = slist; sp; sp = sp->
next ) {
37 if ( !tvlist ) tvlist = tv;
89 for ( i=1, filename = file_list; filename; filename = filename->
next, i++ ) {
91 cout <<
"Reading file: " << *filename << endl;
92 fmod.open(filename->
c_str());
93 if ( fmod.fail() )
return NULL;
95 while ( fmod.getline(aline, 1024) ) {
97 cout <<
"DEBUG read_model_chimera: " << aline << endl;
100 cout <<
"DEBUG read_model_chimera: tag=" << tvlist->
tag << endl;
101 if ( tvlist->
tag ==
"marker_set" ) {
108 cout <<
"DEBUG read_model_chimera: tag=" << tvlist->
tag <<
" value=" << tv->
value << endl;
119 cout <<
"DEBUG read_model_chimera: model id = " << mp->
id << endl;
120 }
else if ( tvlist->
tag ==
"comment" ) {
121 while ( fmod.getline(aline, 1024) && strncmp(aline,
"</comment>", 10) ) {
125 }
else if ( tvlist->
tag ==
"type" ) {
126 for ( tv = tvlist; tv; tv = tv->
next )
127 if ( tv->
tag ==
"id" )
id = tv->
value;
130 for ( tv = tvlist; tv; tv = tv->
next ) {
137 }
else if ( tvlist->
tag ==
"marker" ) {
138 for ( tv = tvlist; tv; tv = tv->
next )
139 if ( tv->
tag ==
"id" )
id = tv->
value;
142 for ( tv = tvlist; tv; tv = tv->
next ) {
143 if ( tv->
tag ==
"type" )
162 }
else if ( tvlist->
tag ==
"link" ) {
163 comp1 = comp2 = NULL;
164 for ( tv = tvlist; tv; tv = tv->
next ) {
165 if ( tv->
tag ==
"id1" )
166 for ( comp = mp->
comp; comp; comp = comp->
next )
167 if ( comp->
id == tv->
value ) comp1 = comp;
168 if ( tv->
tag ==
"id2" )
169 for ( comp = mp->
comp; comp; comp = comp->
next )
170 if ( comp->
id == tv->
value ) comp2 = comp;
172 link =
link_add(&link, comp1, comp2, 0, 1);
174 for ( tv = tvlist; tv; tv = tv->
next ) {
209 for ( n=0, mp =
model; mp; mp = mp->
next, n++ ) {
214 fmod.open(onename.
c_str());
215 if ( fmod.fail() )
return -1;
216 fmod <<
"<?xml version=\"1.0\"?>" << endl;
217 fmod <<
"<marker_set name=\"" << mp->
id <<
"\" type=\"" << mp->
type_id
218 <<
"\" hand=\"" << mp->
hand <<
"\" symmetry=\"" << mp->
symmetry
219 <<
"\" file=\"" << mp->
fmap <<
"\" img_num=\"" << mp->
img_num
220 <<
"\" fom=\"" << mp->
fom <<
"\" select=\"" << mp->
sel <<
"\">" << endl;
221 fmod <<
"<comment>" << endl << mp->
comment << endl <<
"</comment>" << endl;
222 for ( ct = mp->
type; ct; ct = ct->
next ) {
223 fmod <<
"<type id=\"" << ct->
id <<
"\" file=\"" << ct->
fmod
224 <<
"\" num=\"" << ct->
num <<
"\" mass=\"" << ct->
mass
225 <<
"\" fom=\"" << ct->
fom <<
"\" select=\"" << ct->
sel <<
"\"/>" << endl;
227 for ( comp = mp->
comp; comp; comp = comp->
next ) {
228 fmod <<
"<marker id=\"" << comp->
id <<
"\" type=\"" << comp->
type->
id
229 <<
"\" x=\"" << comp->
loc[0] <<
"\" y=\"" << comp->
loc[1]
230 <<
"\" z=\"" << comp->
loc[2] <<
"\" vx=\"" << comp->
view[0]
231 <<
"\" vy=\"" << comp->
view[1] <<
"\" vz=\"" << comp->
view[2]
233 <<
"\" r=\"" << comp->
color[0] <<
"\" g=\"" << comp->
color[1]
234 <<
"\" b=\"" << comp->
color[2] <<
"\" a=\"" << comp->
color[3]
235 <<
"\" radius=\"" << comp->
radius <<
"\" density=\"" << comp->
density
236 <<
"\" fom=\"" << comp->
fom <<
"\" select=\"" << comp->
sel <<
"\"/>" << endl;
238 for ( link = mp->
link; link; link = link->
next ) {
239 fmod <<
"<link id1=\"" << link->
comp[0]->
id <<
"\" id2=\"" << link->
comp[1]->
id
240 <<
"\" r=\"" << link->
color[0] <<
"\" g=\"" << link->
color[1]
241 <<
"\" b=\"" << link->
color[2] <<
"\" a=\"" << link->
color[3]
242 <<
"\" radius=\"" << link->
radius <<
"\" fom=\"" << link->
fom
243 <<
"\" select=\"" << link->
sel <<
"\"/>" << endl;
245 fmod <<
"</marker_set>" << endl;
TagValue * tag_value_parse(char *string)
int string_kill(Bstring *list)
Kills a string linked list.
Header file for reading and writing atomic model files.
Header file for file checking functions.
char * add_item(char **list, unsigned long size)
Adds an item to a linked list.
int tag_value_kill(TagValue *tv)
Bcomponent * component_add(Bcomponent **comp, Bstring &id)
Adds a component to a linked list.
Blink * link_add(Blink **link, Bcomponent *comp1, Bcomponent *comp2, double length, double radius)
Adds a component link to a linked list.
Header file for general utilities.
Bstring within(char c1, char c2)
int write_model_chimera(Bstring &filename, Bmodel *model)
Writes Chimera marker model parameters.
Bmodel * read_model_chimera(Bstring *file_list)
Reads Chimera marker model parameters.
Bstring find_file(Bstring filename, Bstring path, int flag=0)
Searches for a file within or without the given path.
Header file for generalized linked list functions.
Bmodel * model_add(Bmodel **model, Bstring &id)
Adds a model to a linked list.
Bcomptype * model_add_type_by_id(Bmodel *model, Bstring &id)
Add a type to a model if the identifier does not exist already.
bool contains(const Bstring &s)