Messages from list : cormas@cirad.fr

Choose a topic among the following archives :

cormas error?

New Message Reply Date view Thread view Subject view Author view

Subject: cormas error?
From: Paolo Campo (paoloppa@yahoo.com)
Date: Mon Aug 23 2004 - 18:19:01 CEST

Hello.

 

I recently installed the Cormas 2004 version. I encountered a problem with a model that uses the method ‘setFragmentedEntities:from:attribute:’. I don’t encounter this problem in Cormas 2003. I checked the method for both the 2003 and 2004 versions and I noticed a difference, particularly on this line:

 

Cormas2004 version:

 

fragmentedEntity type: collec first type.

 

Cormas2003 version:

 

fragmentedEntity type: (collec first perform: attributeName).

 

So, unlike in the 2003 version wherein the attribute ‘type’ of the fragmented entities are assigned with values based on the user-specified attribute from its components, in the 2004 version the attribute ‘type’ of the fragmented entities are assigned with the values of the attribute ‘type’ of its components. In the model I loaded, the fragmented entities are composed of elementary spatial entities that don’t have the attribute ‘type’; thus an error occurs. Also, I want the value of the attribute ‘type’ to be that of the value of the attribute I specified.

 

For the meantime, to deal with the error, I changed this method in the 2004 version to what it was in the 2003 version by using ‘file-out’ and ‘file-in’.

 

I would like to ask if this is an error or if the change made for this particular method in Cormas 2004 was purposely done? Also, I would like to ask if I did the right thing by reverting the method to its previous version? Wouldn’t it be better to use the previous form of this method rather than the new one, not only for the case of the model I loaded but also for other models using this method? If I am wrong about this, could someone please enlighten me? I included the entire method for both versions at the end of this email for reference.

 

Thanks and best regards,

Paolo

 

From Cormas 2004 version

 

setFragmentedEntities: compoundEntity from: baseEntity attribute: attributeName

                "baseEntity = a Class name inheriting from <SpatialEntity>

                                (can be <SpatialEntityCell> or <SpatialEntityAggregate> or <SpatialEntityNotConnex>)

                compoundEntity = a Class name inheriting from <SpatialEntityNotConnex>"

 

                | fragmentedEntity beInstances collec |

                self boundaries = #closed ifFalse: [^self warningBoundaries].

                self resetCompoundSpatialEntity: compoundEntity andTheirComponents: baseEntity.

                beInstances := (self cormasModel perform: ('the' , baseEntity name asString , 's') asSymbol) copy asOrderedCollection.

                [beInstances isEmpty]

                                whileFalse:

                                                [collec := beInstances select: [:c | (beInstances first perform: attributeName)

                                                                                                                = (c perform: attributeName)].

                                                beInstances removeAll: collec.

                                                fragmentedEntity := compoundEntity new: self.

                                                fragmentedEntity addComponents: collec.

                                                fragmentedEntity type: collec first type.

                                                (self spatialEntities at: compoundEntity name)

                                                                add: fragmentedEntity].

                (self spatialEntities at: compoundEntity name)

                                do: [:c | c show].

                self cormasModel perform: ('the' , compoundEntity name asString , 's:') asSymbol with: (self spatialEntities at: compoundEntity name)

 

from Cormas 2003 version

 

setFragmentedEntities: compoundEntity from: baseEntity attribute: attributeName

                "baseEntity = a Class name inheriting from <SpatialEntity>

                                (can be <SpatialEntityCell> or <SpatialEntityAggregate> or <SpatialEntityNotConnex>)

                compoundEntity = a Class name inheriting from <SpatialEntityNotConnex>"

 

                | fragmentedEntity beInstances collec |

                self boundaries = #closed ifFalse: [^self warningBoundaries].

                self resetCompoundSpatialEntity: compoundEntity andTheirComponents: baseEntity.

                beInstances := (self cormasModel perform: ('the' , baseEntity name asString , 's') asSymbol) copy asOrderedCollection.

                [beInstances isEmpty]

                                whileFalse:

                                                [collec := beInstances select: [:c | (beInstances first perform: attributeName)

                                                                                                                = (c perform: attributeName)].

                                                beInstances removeAll: collec.

                                                fragmentedEntity := compoundEntity new: self.

                                                fragmentedEntity addComponents: collec.

                                                fragmentedEntity type: (collec first perform: attributeName).

                                                (self spatialEntities at: compoundEntity name)

                                                                add: fragmentedEntity].

                (self spatialEntities at: compoundEntity name)

                                do: [:c | c show].

                self cormasModel perform: ('the' , compoundEntity name asString , 's:') asSymbol with: (self spatialEntities at: compoundEntity name)

                
---------------------------------
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!

New Message Reply Date view Thread view Subject view Author view
 

Back to home