PDBLoader.html 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>PDBLoader - Three.js Docs</title>
  6. <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
  7. <script src="../scripts/highlight.min.js"></script>
  8. <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
  9. <link type="text/css" rel="stylesheet" href="../styles/page.css">
  10. </head>
  11. <body>
  12. <p class="inheritance" translate="no"><a href="Loader.html">Loader</a> → </p>
  13. <h1 translate="no">PDBLoader</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>A loader for the PDB format.</p>
  17. <p>The <a href="https://en.wikipedia.org/wiki/Protein_Data_Bank_(file_format)">Protein Data Bank</a>
  18. file format is a textual file describing the three-dimensional structures of molecules.</p></div>
  19. <h2>Code Example</h2>
  20. <div translate="no"><pre><code class="language-js">const loader = new PDBLoader();
  21. const pdb = await loader.loadAsync( 'models/pdb/ethanol.pdb' );
  22. const geometryAtoms = pdb.geometryAtoms;
  23. const geometryBonds = pdb.geometryBonds;
  24. const json = pdb.json;
  25. </code></pre></div>
  26. </header>
  27. <article>
  28. <h2 class="subsection-title">Import</h2>
  29. <p><span translate="no">PDBLoader</span> is an addon, and must be imported explicitly, see <a href="https://threejs.org/manual/#en/installation" target="_blank">Installation#Addons</a>.</p>
  30. <pre><code class="language-js">import { PDBLoader } from 'three/addons/loaders/PDBLoader.js';</code></pre>
  31. <div class="container-overview">
  32. <h2>Constructor</h2>
  33. <h3 class="name name-method" id="PDBLoader" translate="no">new <a href="#PDBLoader">PDBLoader</a><span class="signature">( manager : <span class="param-type">LoadingManager</span> )</span> </h3>
  34. <div class="method">
  35. <div class="description">
  36. <p>Constructs a new PDB loader.</p>
  37. </div>
  38. <table class="params">
  39. <tbody>
  40. <tr>
  41. <td class="name"><code>manager</code></td>
  42. <td class="description last"><p>The loading manager.</p></td>
  43. </tr>
  44. </tbody>
  45. </table>
  46. </div>
  47. </div>
  48. <h2 class="subsection-title">Methods</h2>
  49. <h3 class="name name-method" id="load" translate="no">.<a href="#load">load</a><span class="signature">( url : <span class="param-type">string</span>, onLoad : <span class="param-type">function</span>, onProgress : <span class="param-type">onProgressCallback</span>, onError : <span class="param-type">onErrorCallback</span> )</span> </h3>
  50. <div class="method">
  51. <div class="description">
  52. <p>Starts loading from the given URL and passes the loaded PDB asset
  53. to the <code>onLoad()</code> callback.</p>
  54. </div>
  55. <table class="params">
  56. <tbody>
  57. <tr>
  58. <td class="name"><code>url</code></td>
  59. <td class="description last"><p>The path/URL of the file to be loaded. This can also be a data URI.</p></td>
  60. </tr>
  61. <tr>
  62. <td class="name"><code>onLoad</code></td>
  63. <td class="description last"><p>Executed when the loading process has been finished.</p></td>
  64. </tr>
  65. <tr>
  66. <td class="name"><code>onProgress</code></td>
  67. <td class="description last"><p>Executed while the loading is in progress.</p></td>
  68. </tr>
  69. <tr>
  70. <td class="name"><code>onError</code></td>
  71. <td class="description last"><p>Executed when errors occur.</p></td>
  72. </tr>
  73. </tbody>
  74. </table>
  75. <dl class="details">
  76. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Loader.html#load">Loader#load</a></dt>
  77. </dl>
  78. </div>
  79. <h3 class="name name-method" id="parse" translate="no">.<a href="#parse">parse</a><span class="signature">( text : <span class="param-type">string</span> )</span><span class="type-signature"> : Object</span> </h3>
  80. <div class="method">
  81. <div class="description">
  82. <p>Parses the given PDB data and returns an object holding the atoms and
  83. bond geometries as well as the raw atom data as JSON.</p>
  84. </div>
  85. <table class="params">
  86. <tbody>
  87. <tr>
  88. <td class="name"><code>text</code></td>
  89. <td class="description last"><p>The raw PDB data as a string.</p></td>
  90. </tr>
  91. </tbody>
  92. </table>
  93. <dl class="details">
  94. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Loader.html#parse">Loader#parse</a></dt>
  95. </dl>
  96. <dl class="details">
  97. <dt class="tag-returns"><strong>Returns:</strong> The result object.</dt>
  98. </dl>
  99. </div>
  100. <h2 class="subsection-title">Source</h2>
  101. <p>
  102. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/PDBLoader.js" target="_blank" rel="noopener" translate="no">examples/jsm/loaders/PDBLoader.js</a>
  103. </p>
  104. </article>
  105. </section>
  106. <script src="../scripts/linenumber.js"></script>
  107. <script src="../scripts/page.js"></script>
  108. </body>
  109. </html>
粤ICP备19079148号