OSDN Git Service

Document is updated to include new graphic objects in the model view.
authortoshinagata1964 <toshinagata1964@a2be9bc6-48de-4e38-9406-05402d4bc13c>
Wed, 1 Feb 2012 15:57:45 +0000 (15:57 +0000)
committertoshinagata1964 <toshinagata1964@a2be9bc6-48de-4e38-9406-05402d4bc13c>
Wed, 1 Feb 2012 15:57:45 +0000 (15:57 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/molby/trunk@180 a2be9bc6-48de-4e38-9406-05402d4bc13c

Documents/src/molby_rb/Molecule.html
MolLib/MainView.c
MolLib/MainView.h
MolLib/Ruby_bind/ruby_bind.c
MolLib/cmdtool_stubs.c

index 512938d..461e557 100644 (file)
@@ -67,6 +67,12 @@ Many methods of <a href="Molecule.html">Molecule</a> take a "group" argument, wh
 <p>
 Many methods of <a href="Molecule.html">Molecule</a> are described as "undoable". This means, when such methods are invoked for a <a href="Molecule.html">Molecule</a> that has an associated document, an undo operation is automatically registered to the document. 
 </p>
+<h4>Graphic objects</h4>
+<a name="description-graphic-objects"></a>
+<p>
+(New in 0.6.2) Some Ruby methods allow you to handle graphic objects that are displayed in the same view as the molecule. The methods include <a href="#create_graphic">create_graphic</a>, <a href="#remove_graphic">remove_graphic</a>, <a href="#ngraphics">ngraphics</a>, <a href="#set_graphic_point">set_graphic_point</a>, <a href="#set_graphic_color">set_graphic_color</a>, <a href="#show_graphic">show_graphic</a>, and <a href="#hide_graphic">hide_graphic</a>.
+</p>
+
 </div>
 
 <div id="methods">
@@ -799,6 +805,23 @@ Same as <a href="Molecule.html#M000336">Molecule#insert_frames</a>(nil, coordina
 </div>
 </div>
 
+<div id="method-create_graphic" class="method-detail">
+<a name="create_graphic"></a>
+<div class="method-heading">
+<span class="method-name">create_graphic(kind, color, points, fill = nil) &rarr; Integer</span>
+</div>
+<div class="method-description">
+<p>
+Create a new graphic object. Kind: a symbol representing the kind of the graphic. :line, :poly, :cylinder, :cone, :ellipsoid. Color: an array of 3 (rgb) or 4 (rgba) floating numbers. Points: an array of <a href="Vector3D.html">Vector3D</a>s.
+</p>
+<p>
+Returns the index of the newly created graphic.
+</p>
+<p>
+<i>See Also:</i> <a href="#remove_graphic">Molecule#remove_graphic</a>
+</p></div>
+</div>
+
 <div id="method-M000318" class="method-detail">
 <a name="M000318"></a>
 <div class="method-heading">
@@ -1264,6 +1287,48 @@ Copy the coordinates from the specified frame. If group is specified, then only
 </div>
 </div>
 
+<div id="method-get_view_rotation" class="method-detail">
+<a name="get_view_rotation"></a>
+<div class="method-heading">
+<span class="method-name">get_view_rotation &rarr; [[ax, ay, az], angle]</span>
+</div>
+<div class="method-description">
+<p>
+Get the current rotation for the view. Angle is in degree, not radian.
+</p>
+<p>
+<i>See Also:</i> <a href="#set_view_rotation">Molecule#set_view_rotation</a>
+</p></div>
+</div>
+
+<div id="method-get_view_scale" class="method-detail">
+<a name="get_view_scale"></a>
+<div class="method-heading">
+<span class="method-name">get_view_scale &rarr; Float</span>
+</div>
+<div class="method-description">
+<p>
+Get the current scale for the view. Scale is expressed with a floating-point number in the range -5.0 to 5.0. The scale parameter is transformed to perspective parameters (fovy and distance) in the following way: for negative scale, fovy = 30 deg and distance = cot(15) * 10^(-scale); for positive scale, fovy = 30 * 10^(-scale) and distance = cot(15).
+</p>
+<p>
+<i>See Also:</i> <a href="#set_view_scale">Molecule#set_view_scale</a>
+</p></div>
+</div>
+
+<div id="method-get_view_translation" class="method-detail">
+<a name="get_view_translation"></a>
+<div class="method-heading">
+<span class="method-name">get_view_translation &rarr; <a href="Vector3D.html">Vector3D</a></span>
+</div>
+<div class="method-description">
+<p>
+Get the current translation factor for the view.
+</p>
+<p>
+<i>See Also:</i> <a href="#set_view_translation">Molecule#set_view_translation</a>
+</p></div>
+</div>
+
 <div id="method-M000261" class="method-detail">
 <a name="M000261"></a>
 <div class="method-heading">
@@ -1277,6 +1342,20 @@ Create bonds between atoms that are within the threshold distance. If limit is a
 </div>
 </div>
 
+<div id="method-hide_graphic" class="method-detail">
+<a name="hide_graphic"></a>
+<div class="method-heading">
+<span class="method-name">hide_graphic(graphic_index) &rarr; self</span>
+</div>
+<div class="method-description">
+<p>
+Unset the visibility flag of the graphic_index-th graphic object.
+</p>
+<p>
+<i>See Also:</i> <a href="#show_graphic">Molecule#show_graphic</a>
+</p></div>
+</div>
+
 <div id="method-improper-par" class="method-detail">
 <a name="improper_par"></a>
 <div class="method-heading">
@@ -1827,6 +1906,18 @@ Get the number of frames. Note that the minimum number of frames is 1, not 0.
 </div>
 </div>
 
+<div id="method-ngraphics" class="method-detail">
+<a name="ngraphics"></a>
+<div class="method-heading">
+<span class="method-name">ngraphics &rarr; Integer</span>
+</div>
+<div class="method-description">
+<p>
+Get the number of graphic objects.
+</p>
+</div>
+</div>
+
 <div id="method-M000221" class="method-detail">
 <a name="M000221"></a>
 <div class="method-heading">
@@ -2093,6 +2184,20 @@ If the given group corrensponds to all frames, then the current frame is retaine
 </div>
 </div>
 
+<div id="method-remove_graphic" class="method-detail">
+<a name="remove_graphic"></a>
+<div class="method-heading">
+<span class="method-name">remove_graphic(index) &rarr; index</span>
+</div>
+<div class="method-description">
+<p>
+Remove a graphic object.
+</p>
+<p>
+<i>See Also:</i> <a href="#create_graphic">Molecule#create_graphic</a>
+</p></div>
+</div>
+
 <div id="method-M000257" class="method-detail">
 <a name="M000257"></a>
 <div class="method-heading">
@@ -2391,6 +2496,18 @@ Set the atom attribute for the specified atom. Equivalent to <a href="Molecule.h
 </div>
 </div>
 
+<div id="method-set_background_color" class="method-detail">
+<a name="set_background_color"></a>
+<div class="method-heading">
+<span class="method-name">set_background_color(red, green, blue) &rarr; self</span>
+</div>
+<div class="method-description">
+<p>
+Set the background color of the model view. Red, green, blue are in the range of [0, 1].
+</p>
+</div>
+</div>
+
 <div id="method-M000181" class="method-detail">
 <a name="M000181"></a>
 <div class="method-heading">
@@ -2403,6 +2520,30 @@ Set the dihedral angle n1-n2-n3-n4 to the specified value. The bond n2-n3 should
 </div>
 </div>
 
+<div id="method-set_graphic_color" class="method-detail">
+<a name="set_graphic_color"></a>
+<div class="method-heading">
+<span class="method-name">set_graphic_color(graphic_index, new_vaue) &rarr; new_value</span>
+</div>
+<div class="method-description">
+<p>
+Change the color of graphic_index-th graphic object. The new value must be an array-like object containing three or four numbers.
+</p>
+</div>
+</div>
+
+<div id="method-set_graphic_point" class="method-detail">
+<a name="set_graphic_point"></a>
+<div class="method-heading">
+<span class="method-name">set_graphic_point(graphic_index, point_index, new_value) &rarr; new_value</span>
+</div>
+<div class="method-description">
+<p>
+Change the point_index-th control point of graphic_index-th graphic object. If the object is a line strip, nil is allowed for the new value, which means the line strip ends at the last point.
+</p>
+</div>
+</div>
+
 <div id="method-M000264" class="method-detail">
 <a name="M000264"></a>
 <div class="method-heading">
@@ -2418,6 +2559,48 @@ This operation is undoable.
 </div>
 </div>
 
+<div id="method-set_view_rotation" class="method-detail">
+<a name="set_view_rotation"></a>
+<div class="method-heading">
+<span class="method-name">set_view_rotation(axis, angle) &rarr; self</span>
+</div>
+<div class="method-description">
+<p>
+Set the current rotation for the view. Axis is a <a href="Vector3D.html">Vector3D</a> or an object that can be transformed to a <a href="Vector3D.html">Vector3D</a>. Angle is in degree, not radian.
+</p>
+<p>
+<i>See Also:</i> <a href="#get_view_rotation">Molecule#get_view_rotation</a>
+</p></div>
+</div>
+
+<div id="method-set_view_scale" class="method-detail">
+<a name="set_view_scale"></a>
+<div class="method-heading">
+<span class="method-name">set_view_scale(scale) &rarr; self</span>
+</div>
+<div class="method-description">
+<p>
+Set the current scale for the view. For detailed description of the scale parameter, see <a href="#get_view_scale">Molecule#get_view_scale</a>.
+</p>
+<p>
+<i>See Also:</i> <a href="#get_view_scale">Molecule#get_view_scale</a>
+</p></div>
+</div>
+
+<div id="method-set_view_translation" class="method-detail">
+<a name="set_view_translation"></a>
+<div class="method-heading">
+<span class="method-name">set_view_translation(vec) &rarr; self</span>
+</div>
+<div class="method-description">
+<p>
+Set the current translation for the view.
+</p>
+<p>
+<i>See Also:</i> <a href="#get_view_translation">Molecule#get_view_translation</a>
+</p></div>
+</div>
+
 <div id="method-M000301" class="method-detail">
 <a name="M000301"></a>
 <div class="method-heading">
@@ -2464,6 +2647,20 @@ Set the flag whether to show the expanded atoms. If no argument is given, the cu
 </div>
 </div>
 
+<div id="method-show_graphic" class="method-detail">
+<a name="show_graphic"></a>
+<div class="method-heading">
+<span class="method-name">show_graphic(graphic_index) &rarr; self</span>
+</div>
+<div class="method-description">
+<p>
+Set the visibility flag of the graphic_index-th graphic object.
+</p>
+<p>
+<i>See Also:</i> <a href="#hide_graphic">Molecule#hide_graphic</a>
+</p></div>
+</div>
+
 <div id="method-M000307" class="method-detail">
 <a name="M000307"></a>
 <div class="method-heading">
@@ -2471,7 +2668,6 @@ Set the flag whether to show the expanded atoms. If no argument is given, the cu
 self.show_graphite = Integer<br />
 </span>
 </div>
-
 <div class="method-description">
 <p>
 Set whether to show the graphite plane. The plane is assumed to be on the xy plane. If the argument is positive, it also indicates the number of rings to display for each direction. If the argument is zero, the plane is not displayed. If no argument is given, the current value is returned.
@@ -2746,4 +2942,4 @@ defined, exception is raised. This operation is undoable.
 </div>
 
 </body>
-</html>
\ No newline at end of file
+</html>
index 10e31e2..dd4942c 100755 (executable)
@@ -2182,7 +2182,7 @@ MainView_insertGraphic(MainView *mview, int index, const MainViewGraphic *graphi
 }
 
 int
-MainView_deleteGraphic(MainView *mview, int index)
+MainView_removeGraphic(MainView *mview, int index)
 {
        MainViewGraphic *g;
        if (index < 0 || index >= mview->ngraphics)
index a12dadc..2ce2502 100755 (executable)
@@ -195,7 +195,7 @@ int MainView_getMode(const MainView *mview);
 void MainView_setBackgroundColor(MainView *mview, float red, float green, float blue);
 void MainView_getBackgroundColor(const MainView *mview, float *rgb);
 int MainView_insertGraphic(MainView *mview, int index, const MainViewGraphic *graphic);
-int MainView_deleteGraphic(MainView *mview, int index);
+int MainView_removeGraphic(MainView *mview, int index);
 
 void MainView_attachLabelToAtom(MainView *mview, int index);
 void MainView_detachLabelFromAtom(MainView *mview, int index);
index 91d5f9c..abc6c64 100644 (file)
@@ -8049,12 +8049,12 @@ s_Molecule_CreateGraphic(int argc, VALUE *argv, VALUE self)
 
 /*
  *  call-seq:
- *     delete_graphic(index) -> integer
+ *     remove_graphic(index) -> integer
  *
- *  Delete a graphic object.
+ *  Remove a graphic object.
  */
 static VALUE
-s_Molecule_DeleteGraphic(VALUE self, VALUE ival)
+s_Molecule_RemoveGraphic(VALUE self, VALUE ival)
 {
     Molecule *mol;
        int i;
@@ -8064,7 +8064,7 @@ s_Molecule_DeleteGraphic(VALUE self, VALUE ival)
        i = NUM2INT(rb_Integer(ival));
        if (i < 0 || i >= mol->mview->ngraphics)
                rb_raise(rb_eArgError, "graphic index is out of range");
-       MainView_deleteGraphic(mol->mview, i);
+       MainView_removeGraphic(mol->mview, i);
        return ival;
 }
 
@@ -8949,6 +8949,7 @@ Init_Molby(void)
        rb_define_method(rb_cMolecule, "line_mode", s_Molecule_LineMode, -1);
        rb_define_alias(rb_cMolecule, "line_mode=", "line_mode");
        rb_define_method(rb_cMolecule, "resize_to_fit", s_Molecule_ResizeToFit, 0);
+#if !defined(__CMDMAC__)
        rb_define_method(rb_cMolecule, "get_view_rotation", s_Molecule_GetViewRotation, 0);
        rb_define_method(rb_cMolecule, "get_view_scale", s_Molecule_GetViewScale, 0);
        rb_define_method(rb_cMolecule, "get_view_translation", s_Molecule_GetViewTranslation, 0);
@@ -8957,12 +8958,13 @@ Init_Molby(void)
        rb_define_method(rb_cMolecule, "set_view_translation", s_Molecule_SetViewTranslation, 1);
        rb_define_method(rb_cMolecule, "set_background_color", s_Molecule_SetBackgroundColor, -1);
        rb_define_method(rb_cMolecule, "create_graphic", s_Molecule_CreateGraphic, -1);
-       rb_define_method(rb_cMolecule, "delete_graphic", s_Molecule_DeleteGraphic, 1);
+       rb_define_method(rb_cMolecule, "remove_graphic", s_Molecule_RemoveGraphic, 1);
        rb_define_method(rb_cMolecule, "ngraphics", s_Molecule_NGraphics, 0);
        rb_define_method(rb_cMolecule, "set_graphic_point", s_Molecule_SetGraphicPoint, 3);
        rb_define_method(rb_cMolecule, "set_graphic_color", s_Molecule_SetGraphicColor, 2);
        rb_define_method(rb_cMolecule, "show_graphic", s_Molecule_ShowGraphic, 1);
        rb_define_method(rb_cMolecule, "hide_graphic", s_Molecule_HideGraphic, 1);
+#endif
        rb_define_method(rb_cMolecule, "show_text", s_Molecule_ShowText, 1);
        rb_define_method(rb_cMolecule, "md_arena", s_Molecule_MDArena, 0);
        rb_define_method(rb_cMolecule, "set_parameter_attr", s_Molecule_SetParameterAttr, 5);
index a484094..13b4919 100644 (file)
@@ -158,6 +158,11 @@ MainViewCallback_display(MainView *mview)
 {
 }
 
+void
+MainViewCallback_makeFront(MainView *mview)
+{
+}
+
 int
 MolActionCallback_setUndoRegistrationEnabled(Molecule *mol, int flag)
 {
@@ -220,6 +225,12 @@ MoleculeCallback_displayName(Molecule *mol, char *buf, int bufsize)
        buf[0] = 0;
 }
 
+int
+MoleculeCallback_setDisplayName(Molecule *mol, const char *name)
+{
+       return 0;
+}
+
 void
 MoleculeCallback_pathName(Molecule *mol, char *buf, int bufsize)
 {