📄 renderer2dmodel.java
字号:
/** * Sets wether Atom-Atom mapping must be shown. */ public void setShowAtomAtomMapping(boolean value) { this.showAtomAtomMapping = value; fireChange(); } /** * XXX No idea what this is about. */ public int getAtomRadius() { return this.atomRadius; } /** * XXX No idea what this is about. * * @param atomRadius XXX No idea what this is about */ public void setAtomRadius(int atomRadius) { this.atomRadius = atomRadius; fireChange(); } /** * Returns the atom currently highlighted. * * @return the atom currently highlighted */ public IAtom getHighlightedAtom() { return this.highlightedAtom; } /** * Sets the atom currently highlighted. * * @param highlightedAtom The atom to be highlighted */ public void setHighlightedAtom(IAtom highlightedAtom) { if ((this.highlightedAtom != null) || (highlightedAtom != null)) { this.highlightedAtom = highlightedAtom; fireChange(); } } /** * Returns the Bond currently highlighted. * * @return the Bond currently highlighted */ public IBond getHighlightedBond() { return this.highlightedBond; } /** * Sets the Bond currently highlighted. * * @param highlightedBond The Bond to be currently highlighted */ public void setHighlightedBond(IBond highlightedBond) { if ((this.highlightedBond != null) || (highlightedBond != null)) { this.highlightedBond = highlightedBond; fireChange(); } } /** * Returns the hashtable used for coloring substructures. * * @return the hashtable used for coloring substructures */ public Hashtable getColorHash() { return this.colorHash; } /** * Returns the drawing color of the given atom. * An atom is colored as highlighted if hightlighted. * The atom is color marked if in a substructure. * If not, the color from the CDK2DAtomColor is used * (if selected). Otherwise, the atom is colored black. */ public Color getAtomColor(IAtom atom, Color defaultColor) { // logger.debug("Getting atom front color for " + atom.toString()); Color atomColor = defaultColor; if (colorAtomsByType) { // logger.debug("Coloring atom by type"); atomColor = colorer.getAtomColor(atom); } // logger.debug("Color: " + atomColor.toString()); return atomColor; } /** * Returns the background color of the given atom. */ public Color getAtomBackgroundColor(IAtom atom) { // logger.debug("Getting atom back color for " + atom.toString()); Color atomColor = getBackColor(); // logger.debug(" BackColor: " + atomColor.toString()); Color hashColor = (Color) this.getColorHash().get(atom); if (hashColor != null) { // logger.debug("Background color atom according to hashing (substructure)"); atomColor = hashColor; } if (atom == this.getHighlightedAtom()) { // logger.debug("Background color atom according to highlighting"); atomColor = this.getHoverOverColor(); } // logger.debug("Color: " + atomColor.toString()); return atomColor; } /** * Returns the current atom colorer. * * @return The AtomColorer. */ public IAtomColorer getAtomColorer() { return colorer; } /** * Sets the atom colorer. * * @param atomColorer the new colorer. */ public void setAtomColorer(final IAtomColorer atomColorer) { colorer = atomColorer; } /** * Sets the hashtable used for coloring substructures * * @param colorHash the hashtable used for coloring substructures */ public void setColorHash(Hashtable colorHash) { this.colorHash = colorHash; fireChange(); } /** * Returns the end of the pointer vector * * @return the end point */ public Point getPointerVectorEnd() { return this.pointerVectorEnd; } /** * Sets the end of a pointer vector * * @param pointerVectorEnd */ public void setPointerVectorEnd(Point pointerVectorEnd) { this.pointerVectorEnd = pointerVectorEnd; fireChange(); } /** * Returns the start of a pointer vector * * @return the start point */ public Point getPointerVectorStart() { return this.pointerVectorStart; } /** * Sets the start point of a pointer vector * * @param pointerVectorStart */ public void setPointerVectorStart(Point pointerVectorStart) { this.pointerVectorStart = pointerVectorStart; fireChange(); } /** * Returns selected rectangular * * @return the selection */ public Polygon getSelectRect() { return this.selectRect; } /** * Sets a selected region * * @param selectRect */ public void setSelectRect(Polygon selectRect) { this.selectRect = selectRect; fireChange(); } /** * Returns the atoms and bonds on the Renderer2D clipboard. If the clipboard * is empty it returns null. * Primarily used for copy/paste. * * @return an atomcontainer with the atoms and bonds on the clipboard. */ public IAtomContainer getClipboardContent() { return clipboardContent; } /** * Sets the atoms and bonds on the Renderer2D clipboard. * Primarily used for copy/paste. * * @param content the new content of the clipboard. */ public void setClipboardContent(IAtomContainer content) { this.clipboardContent = content; } /** * Get selected atoms. These are atoms selected internally in e. g. JCP with the lasso, painted in selectedPartColor * * @return an atomcontainer with the selected atoms */ public IAtomContainer getSelectedPart() { return this.selectedPart; } /** * Sets the selected atoms. These are atoms selected internally in e. g. JCP with the lasso, painted in selectedPartColor * * @param selectedPart */ public void setSelectedPart(IAtomContainer selectedPart) { this.selectedPart = selectedPart; getColorHash().clear(); for (int i = 0; i < selectedPart.getAtomCount(); i++) { getColorHash().put(selectedPart.getAtom(i), this.getSelectedPartColor()); } Iterator bonds = selectedPart.bonds(); while (bonds.hasNext()) { getColorHash().put(bonds.next(), getSelectedPartColor()); } fireChange(); } /** * Returns a set of points constituating a selected region * * @return a vector with points */ public Vector getLassoPoints() { return this.lassoPoints; } /** * Adds a point to the list of lasso points * * @param point Point to add to list */ public void addLassoPoint(Point point) { this.lassoPoints.addElement(point); fireChange(); } /** * Adds a change listener to the list of listeners * * @param listener The listener added to the list */ public void addCDKChangeListener(ICDKChangeListener listener) { if (listeners == null) { listeners = new Vector(); } if (!listeners.contains(listener)) { listeners.add(listener); } } /** * Removes a change listener from the list of listeners * * @param listener The listener removed from the list */ public void removeCDKChangeListener(ICDKChangeListener listener) { listeners.remove(listener); } /** * Notifies registered listeners of certain changes * that have occurred in this model. */ public void fireChange() { if (getNotification()) { EventObject event = new EventObject(this); if (listeners == null) { listeners = new Vector(); } for (int i = 0; i < listeners.size(); i++) { ((ICDKChangeListener)listeners.get(i)).stateChanged(event); } } } /** * Gets the toolTipText for atom certain atom. * * @param atom The atom. * @return The toolTipText value. */ public String getToolTipText(IAtom atom) { if (toolTipTextMap.get(atom) != null) { return ((String) toolTipTextMap.get(atom)); } else { return null; } } /** * Sets the showTooltip attribute. * * @param showToolTip The new value. */ public void setShowTooltip(boolean showToolTip) { this.showTooltip = showToolTip; fireChange(); } /** * Gets showTooltip attribute. * * @return The showTooltip value. */ public boolean getShowTooltip(){ return(showTooltip); } /** * Sets the toolTipTextMap. * * @param map A map containing Atoms of the current molecule as keys and Strings to display as values. A line break will be inserted where a \n is in the string. */ public void setToolTipTextMap(HashMap map){ toolTipTextMap=map; fireChange(); } /** * Gets the toolTipTextMap. * * @return The toolTipTextValue. */ public HashMap getToolTipTextMap(){ return toolTipTextMap; } /** * This is the central facility for handling "merges" of atoms. A merge occures if during moving atoms an atom is in Range of another atom. * These atoms are then put into the merge map as a key-value pair. During the move, the atoms are then marked by a circle and on releasing the mouse * they get actually merged, meaning one atom is removed and bonds pointing to this atom are made to point to the atom it has been marged with. * * @return Returns the merge.map */ public HashMap getMerge() { return merge; } public double[] getRotateCenter() { return rotateCenter; } public void setRotateCenter(double x, double y) { double[] rotateCenter={x,y}; this.rotateCenter = rotateCenter; } public double getRotateRadius() { return rotateRadius; } public void setRotateRadius(double rotateRadius) { this.rotateRadius = rotateRadius; } /** * Gets the color used for drawing the part which was selected externally */ public Color getExternalHighlightColor() { return externalHighlightColor; } /** * Sets the color used for drawing the part which was selected externally * * @param externalHighlightColor The color */ public void setExternalHighlightColor(Color externalHighlightColor) { this.externalHighlightColor = externalHighlightColor; } /** * Gets the color used for drawing the part we are hovering over. */ public Color getHoverOverColor() { return hoverOverColor; } /** * Sets the color used for drawing the part we are hovering over. * * @param hoverOverColor The color */ public void setHoverOverColor(Color hoverOverColor) { this.hoverOverColor = hoverOverColor; } /** * Gets the color used for drawing the internally selected part. */ public Color getSelectedPartColor() { return selectedPartColor; } /** * Sets the color used for drawing the internally selected part. * * @param selectedPartColor The color */ public void setSelectedPartColor(Color selectedPartColor) { this.selectedPartColor = selectedPartColor; } /** * Get externally selected atoms. These are atoms selected externally in e. g. Bioclipse via the ChemObjectTree, painted in externalSelectedPartColor * * @return the selected part */ public IAtomContainer getExternalSelectedPart() { return externalSelectedPart; } /** * Set externally selected atoms. These are atoms selected externally in e. g. Bioclipse via the ChemObjectTree, painted in externalSelectedPartColor * * @param externalSelectedPart the selected part */ public void setExternalSelectedPart(IAtomContainer externalSelectedPart) { this.externalSelectedPart = externalSelectedPart; getColorHash().clear(); for (int i = 0; i < externalSelectedPart.getAtomCount(); i++) { getColorHash().put(externalSelectedPart.getAtom(i), this.getExternalHighlightColor()); } Iterator bonds = externalSelectedPart.bonds(); while (bonds.hasNext()) { getColorHash().put(bonds.next(), getExternalHighlightColor()); } fireChange(); } public boolean getNotification() { return notification; } public void setNotification(boolean notification) { this.notification = notification; } public boolean showAtomTypeNames() { return showAtomTypeNames; } public void setShowAtomTypeNames(boolean showAtomTypeNames) { this.showAtomTypeNames = showAtomTypeNames; } public void setRenderingCoordinates(HashMap renderingCoordinates) { this.renderingCoordinates = renderingCoordinates; } public double getMargin() { return margin; } public void setMargin(double margin) { this.margin = margin; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -