{
logger.info("chimera open " + modelPath);
// stopListening();
+ List<ChimeraModel> modelList = getModelList();
List<String> response = null;
// TODO: [Optional] Handle modbase models
if (type == ModelType.MODBASE_MODEL)
logger.warn("Could not open " + modelPath);
return null;
}
- List<ChimeraModel> chimeraModels = getModelList();
+
+ List<ChimeraModel> newModelList = getModelList();
+ for (ChimeraModel newModel : newModelList)
+ {
+ if (!modelList.contains(newModel))
+ {
+ newModel.setModelName(modelName);
+ sendChimeraCommand(
+ "setattr M name " + modelName + " #"
+ + newModel.getModelNumber(), false);
+ modelList.add(newModel);
+
+ }
+ }
+
// assign color and residues to open models
- for (ChimeraModel chimeraModel : chimeraModels)
+ for (ChimeraModel chimeraModel : modelList)
{
// // patch for Jalview - set model name in Chimera
// // TODO: find a variant that works for sub-models
- chimeraModel.setModelName(modelName);
- sendChimeraCommand(
- "setattr M name " + modelName + " #"
- + chimeraModel.getModelNumber(), false);
// get model color
Color modelColor = getModelColor(chimeraModel);
if (modelColor != null)
sendChimeraCommand("focus", false);
// startListening(); // see ChimeraListener
- return chimeraModels;
+ return modelList;
}
/**
*
* @return ChimeraModel
*/
+ @Override
public ChimeraModel getChimeraModel()
{
return this;
*
* @return user data
*/
+ @Override
public Object getUserData()
{
return userData;
* @param data
* user data to associate with this model
*/
+ @Override
public void setUserData(Object data)
{
this.userData = data;
*
* @return the selected state
*/
+ @Override
public boolean isSelected()
{
return selected;
* @param selected
* a boolean to set the selected state to
*/
+ @Override
public void setSelected(boolean selected)
{
this.selected = selected;
*
* @return the chains in this model as a list
*/
+ @Override
public List<ChimeraStructuralObject> getChildren()
{
return new ArrayList<ChimeraStructuralObject>(chainMap.values());
/**
* Checks if this model has selected children.
*/
+ @Override
public boolean hasSelectedChildren()
{
if (selected)
/**
* Return the Chimera specification for this model.
*/
+ @Override
public String toSpec()
{
if (subModelNumber == 0)
+ {
return ("#" + modelNumber);
+ }
return ("#" + modelNumber + "." + subModelNumber);
}
* Return a string representation for the model. Shorten if longer than 100
* characters.
*/
+ @Override
public String toString()
{
String modelName = "";
}
return nodeName;
}
+
+ @Override
+ public boolean equals(Object otherChimeraModel)
+ {
+ if (!(otherChimeraModel instanceof ChimeraModel))
+ {
+ return false;
+ }
+ ChimeraModel otherCM = ((ChimeraModel) otherChimeraModel);
+ return this.name.equals(otherCM.name)
+ && this.modelNumber == otherCM.modelNumber
+ && this.type == otherCM.type;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ int hashCode = 1;
+ hashCode = hashCode * 37 + this.name.hashCode();
+ hashCode = hashCode * 37 + this.type.hashCode();
+ hashCode = (hashCode * 37) + modelNumber;
+ return hashCode;
+ }
}