النماذج
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
 |
في ملف KML، يمكنك استيراد نماذج ثلاثية الأبعاد - مثل المباني والجسور والآثار والتماثيل - بتنسيق ملف تحويل COLLADA. يتم تحديد النماذج بشكل مستقل عن Google Earth في مكان إحداثياتها الخاص باستخدام تطبيقات مثل SketchUp أو 3D Studio Max أو Softimage XSI أو Maya. عندما يتم استيراد نموذج ثلاثي الأبعاد إلى Google Earth، يتم تحويله وتدويره وتحجيمه ليناسب نظام إحداثيات Earth. يمكن إعادة ضبط مواضع النماذج التي تم تحميلها من قبل في Google Earth وتغيير حجمها باستخدام العنصر <تحديث>. |
نموذج للنماذج
يتم استخدام نموذج في Google Earth مثل أي كائن هندسي آخر (نقطة أو سطر خطي أو مضلع). في ما يلي مثال بسيط على ملف KML يستورد نموذجًا مزخرفًا.
يمكن أن يكون مرجع النموذج رابطًا مطلقًا أو نسبيًا لمواصفات الملف، أو عنوان URL.
لعرض هذا النموذج، حمّل الملف MackyBldg.kmz، وهو أرشيف يحتوي على جميع ملفات الزخارف والتراكبات الضرورية وكذلك ملف doc.kml الذي يحتوي على النموذج:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Placemark>
<name>SketchUp Model of Macky Auditorium</name>
<description>University of Colorado, Boulder; model created by Noël Nemcik.</description>
<LookAt>
<longitude>-105.2727379358738</longitude>
<latitude>40.01000594412381</latitude>
<altitude>0</altitude>
<range>127.2393107680517</range>
<tilt>65.74454495876547</tilt>
<heading>-27.70337734057933</heading>
</LookAt>
<Model id="model_4">
<altitudeMode>relativeToGround</altitudeMode>
<Location>
<longitude>-105.272774533734</longitude>
<latitude>40.009993372683</latitude>
<altitude>0</altitude>
</Location>
<Orientation>
<heading>0</heading>
<tilt>0</tilt>
<roll>0</roll>
</Orientation>
<Scale>
<x>1</x>
<y>1</y>
<z>1</z>
</Scale>
<Link>
<href>MackyBldg.kmz/files/CU Macky.dae</href>
</Link>
<ResourceMap id="resourcemap_for_model_4">
<Alias>
<sourceHref>../files/CU-Macky---Center-StairsnoCulling.jpg</sourceHref>
<targetHref>C:/DOCUME~1/josiew/LOCALS~1/Temp/MackyBldg.kmz/files/CU-Macky---Center-StairsnoCulling.jpg</targetHref>
</Alias>
<Alias>
<sourceHref>../files/CU-Macky-4sideturretnoCulling.jpg</sourceHref>
<targetHref>../files/CU-Macky-4sideturretnoCulling.jpg</targetHref>
</Alias>
<Alias>
<sourceHref>../files/CU-Macky-Back-NorthnoCulling.jpg</sourceHref>
<targetHref>../files/CU-Macky-Back-NorthnoCulling.jpg</targetHref>
</Alias>
<Alias>
<sourceHref>../files/CU-Macky-BrickwallnoCulling.jpg</sourceHref>
<targetHref>../files/CU-Macky-BrickwallnoCulling.jpg</targetHref>
</Alias>
.
.
.
</ResourceMap>
</Model>
</Placemark>
</kml>
يتم وضع النموذج جغرافيًا باستخدام مواصفات خطوط الطول والعرض والطول لعنصر الموقع الجغرافي. يستخدم هذا المثال القيم الافتراضية لعناصر الاتجاه والمقياس، والتي يتم تضمينها هنا للاكتمال.
يحدد عنصر الاتجاه عمليات تدوير النموذج حول المحاور x (الإمالة) وy (roll) وz (heading). يشير المحور ص إلى الشمال وهو موازٍ لخطوط الطول، والمحور س شرقًا ويوازي خطوط الخطوط. يتم تحديد التدوير بالدرجات، مع التدوير الإيجابي كما هو موضح في الرسم البياني التالي.

يعيّن عنصر ResourceMap ملفات الزخرفة من الموقع المحدد في ملف Collada الأصلي (<sourceHref>) إلى موقع في ملف KML أو KMZ (<targetHref>) يحتوي على النموذج.
ملاحظة: في الإصدارات التي تسبق إصدار Google Earth 4.2، تم إجراء وظيفة التعيين هذه بواسطة ملف textures.txt (ملف خارجي مضمن في أرشيف KMZ). يقبل Google Earth 4.2 ملفات KML وKMZ التي تشير إلى ملف textures.txt ويعالجها بشكل صحيح. عند كتابة هذه الملفات من خلال برامج Google Earth 4.2 والإصدارات الأحدث، يتم ترجمة المعلومات في ملف textures.txt إلى عنصري <ResourceMap> و<Alias>، وهما تابعان للعنصر <Model>.
إنشاء أرشيف .kmz
أرشيف KMZ هو مجموعة من الملفات المستخدمة لإنشاء عرض تقديمي KML واحد. يتضمن هذا الأرشيف جميع الملفات المحلية المشار إليها في ملف .kml، مثل الصور والزخارف والنماذج. أرشيف KMZ هو حزمة قائمة بذاتها لا يلزم استضافتها على خادم شبكة ويمكن إرسالها بالبريد الإلكتروني وتخزينها بسهولة كوحدة واحدة. يمكن لبرنامج Google Earth قراءة ملفات .kml و.kmz مباشرة.
يتم ضغط ملف doc.kml والملفات المحلية التي يشير إليها في أرشيف باستخدام تنسيق ملف ZIP. يمكن للعديد من التطبيقات إنتاج هذا التنسيق. WinZip على أنظمة تشغيل Windows وSuffit على أنظمة التشغيل Macintosh وZip على أنظمة Linux وMacintosh هي تطبيقات شائعة يمكنها قراءة تنسيق ZIP وكتابته. يمكنك أيضًا العمل باستخدام أرشيفات ZIP باستخدام مستكشف Windows أو Mac Finder مباشرةً.
بعد إنشاء ملف .zip، غيِّر امتداد الملف إلى .kmz.
يحتوي أرشيف KMZ الذي يحتوي على النموذج المزخرف الكامل لمبنى ماكي على الملفات التالية:
- doc.kml - ملف KML الموضح أعلاه، والذي يستورد نموذج COLLADA (.dae) ويضعه في Google Earth. ضع هذا الملف في الدليل الجذري لملف KMZ (ZIP).
- دليل files/ - يحتوي على ملفات COLLADA التي تحدد الأشكال الهندسية والزخارف والمواد المستخدمة في النموذج. في مثال مبنى ماكي، يحتوي هذا الدليل على ملف COLLADA (CU Macky.dae) بالإضافة إلى الملفات المتعددة التي تحتوي على صور JPEG المستخدمة في زخرفة المبنى (CU-Macky-BrickwallnoCulling.jpg، وCU-Macky--Center-StairsnoCulling.jpg، وCU_Macky-EastjpgdoornoCulling on).
يوضح هذا المثال إحدى طرق تنظيم الملفات في أرشيف KMZ. في الواقع، يمكنك ترتيب الملفات بأي بنية تبدو منطقية بالنسبة إليك، تمامًا كما تنظم الملفات في مجلدات أو أدلة على جهاز الكمبيوتر. على سبيل المثال، قد يكون من المفيد وضع جميع الصور في دليل images/. يتم تحديد المراجع النسبية (مثل الملفات المُشار إليها في العنصر <href> المستخدمة في NetworkLink وLink والتراكب/الرمز والنموذج) مقارنةً بملف doc.kml. في حالة تضمين دليل صور، ستكون مواصفات <href> لصورك كما يلي: images/myBrickTexture.jpg وimages/myMountainoverlay.png وهكذا).
الرجوع إلى أعلى الصفحة
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة Oracle و/أو شركائها التابعين.
تاريخ التعديل الأخير: 2022-12-20 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2022-12-20 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003eKML allows importing 3D models like buildings and monuments using the COLLADA file format, which are positioned and scaled within Google Earth.\u003c/p\u003e\n"],["\u003cp\u003eModels are defined in their own coordinate space using 3D modeling software and then integrated into Google Earth using latitude, longitude, and altitude.\u003c/p\u003e\n"],["\u003cp\u003eA KMZ archive is a compressed file containing the KML file and associated resources like textures and models, simplifying distribution.\u003c/p\u003e\n"],["\u003cp\u003eThe ResourceMap element within the KML file maps texture files from their original location to their location within the KMZ archive.\u003c/p\u003e\n"],["\u003cp\u003eKMZ archives can be created using standard ZIP compression tools and are readily opened in Google Earth.\u003c/p\u003e\n"]]],[],null,["# Models\n\n|---|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| | In KML, you can import 3D models---such as buildings, bridges, monuments, and statues---in the COLLADA interchange file format. Models are defined independently of Google Earth in their own coordinate space, using applications such as [SketchUp](http://sketchup.google.com/), 3D Studio Max, Softimage XSI, or Maya. When a 3D model is imported into Google Earth, it is translated, rotated, and scaled to fit into the Earth coordinate system. Models already loaded into Google Earth can be repositioned and resized using the \\\u003cUpdate\\\u003e element. |\n\nSample Model\n============\n\nA model is used in Google Earth just as any other geometry object (point, linestring, or polygon). Here is a simple example of a KML file that imports a textured model.\n\nThe \\\u003cLink\\\u003e reference to the model can be an an absolute or relative file specification, or a URL.\n\nTo view this model, load the file [*MackyBldg.kmz*](/static/kml/documentation/MackyBldg.kmz), which is an archive that contains all the necessary texture and overlay files as well as this *doc.kml* file containing the Model: \n\n```\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003ckml xmlns=\"http://www.opengis.net/kml/2.2\"\u003e\n\u003cPlacemark\u003e\n \u003cname\u003eSketchUp Model of Macky Auditorium\u003c/name\u003e\n \u003cdescription\u003eUniversity of Colorado, Boulder; model created by Noël Nemcik.\u003c/description\u003e\n \u003cLookAt\u003e\n \u003clongitude\u003e-105.2727379358738\u003c/longitude\u003e\n \u003clatitude\u003e40.01000594412381\u003c/latitude\u003e\n \u003caltitude\u003e0\u003c/altitude\u003e\n \u003crange\u003e127.2393107680517\u003c/range\u003e\n \u003ctilt\u003e65.74454495876547\u003c/tilt\u003e\n \u003cheading\u003e-27.70337734057933\u003c/heading\u003e\n \u003c/LookAt\u003e\n \u003cModel id=\"model_4\"\u003e\n \u003caltitudeMode\u003erelativeToGround\u003c/altitudeMode\u003e\n \u003cLocation\u003e\n \u003clongitude\u003e-105.272774533734\u003c/longitude\u003e\n \u003clatitude\u003e40.009993372683\u003c/latitude\u003e\n \u003caltitude\u003e0\u003c/altitude\u003e\n \u003c/Location\u003e\n \u003cOrientation\u003e\n \u003cheading\u003e0\u003c/heading\u003e\n \u003ctilt\u003e0\u003c/tilt\u003e\n \u003croll\u003e0\u003c/roll\u003e\n \u003c/Orientation\u003e\n \u003cScale\u003e\n \u003cx\u003e1\u003c/x\u003e\n \u003cy\u003e1\u003c/y\u003e\n \u003cz\u003e1\u003c/z\u003e\n \u003c/Scale\u003e\n \u003cLink\u003e\n \u003chref\u003eMackyBldg.kmz/files/CU Macky.dae\u003c/href\u003e\n \u003c/Link\u003e\n \u003cResourceMap id=\"resourcemap_for_model_4\"\u003e\n \u003cAlias\u003e\n \u003csourceHref\u003e../files/CU-Macky---Center-StairsnoCulling.jpg\u003c/sourceHref\u003e\n \u003ctargetHref\u003eC:/DOCUME~1/josiew/LOCALS~1/Temp/MackyBldg.kmz/files/CU-Macky---Center-StairsnoCulling.jpg\u003c/targetHref\u003e\n \u003c/Alias\u003e\n \u003cAlias\u003e\n \u003csourceHref\u003e../files/CU-Macky-4sideturretnoCulling.jpg\u003c/sourceHref\u003e\n \u003ctargetHref\u003e../files/CU-Macky-4sideturretnoCulling.jpg\u003c/targetHref\u003e\n \u003c/Alias\u003e\n \u003cAlias\u003e\n \u003csourceHref\u003e../files/CU-Macky-Back-NorthnoCulling.jpg\u003c/sourceHref\u003e\n \u003ctargetHref\u003e../files/CU-Macky-Back-NorthnoCulling.jpg\u003c/targetHref\u003e\n \u003c/Alias\u003e\n \u003cAlias\u003e\n \u003csourceHref\u003e../files/CU-Macky-BrickwallnoCulling.jpg\u003c/sourceHref\u003e\n \u003ctargetHref\u003e../files/CU-Macky-BrickwallnoCulling.jpg\u003c/targetHref\u003e\n \u003c/Alias\u003e\n.\n.\n.\n \u003c/ResourceMap\u003e\n \u003c/Model\u003e\n\u003c/Placemark\u003e\n\u003c/kml\u003e\n```\n\nThe model is positioned geographically with the Location element's latitude, longitude, and altitude specifications. This example uses default values for the Orientation and Scale elements, which are included here for completeness.\n\nThe Orientation element specifies rotations of the model around the *x* (*tilt* ), *y* (*roll* ) and *z* (*heading* ) axes. The *y* axis points North and is parallel to longitude lines, and the x axis points East and is parallel to latitude lines. Rotations are specified in degrees, with positive rotations as shown in the following diagram.\n\nThe ResourceMap element maps the texture files from the location specified in the original Collada file (\\\u003csourceHref\\\u003e) to a location in the KML or KMZ file (\\\u003ctargetHref\\\u003e) that contains the Model.\n\n**Note:** In releases prior to Google Earth Release 4.2, this mapping function was performed by the *textures.txt* file (an external file included in the KMZ archive). Google Earth 4.2 accepts KML and KMZ files that refer to a *textures.txt* file and processes them correctly. When such files are written out by Google Earth 4.2 clients and later, the information in the *textures.txt* file is translated into the \\\u003cResourceMap\\\u003e and \\\u003cAlias\\\u003e elements, which are children of \\\u003cModel\\\u003e.\n\nCreating a *.kmz* Archive\n=========================\n\nA *KMZ archive* is collection of files used to create a single KML presentation. This archive includes all the local files that are referenced in the *.kml* file, such as images, textures, and models. A KMZ archive is a self-contained package that does not need to be hosted on a network server and can easily be e-mailed and stored as a single unit. Google Earth can read *.kml* and *.kmz* files directly.\n\nThe *doc.kml* file and the local files it references are compressed into an archive using the ZIP file format. Many applications can produce this format. WinZip on Windows systems, Stuffit on Macintosh systems, and zip on Linux or Macintosh systems are popular applications that can read and write the ZIP format. You can also work with zip archives using the Windows Explorer or Mac Finder directly.\n\nAfter you have created the *.zip* file, change the file extension to .*kmz*.\n\nThe KMZ archive containing the complete textured model for the Macky Building includes these files:\n\n- ***doc.kml*** - the KML file shown above, which imports the COLLADA *(.dae)* model and places it in Google Earth. Place this file in the root directory of the KMZ (ZIP) file.\n\n\u003c!-- --\u003e\n\n- ***files/*** directory - contains the COLLADA files that define the geometry, textures, and material of the model. In the Macky Building example, this directory contains the COLLADA file *(CU Macky.dae)* as well as the numerous files containing the JPEG images used to texture the building (*CU-Macky-BrickwallnoCulling.jpg, CU-Macky--Center-StairsnoCulling.jpg, CU_Macky-EastdetaildoornoCulling.jpg*, and so on).\n\nThis example illustrates one way to structure the files in a KMZ archive. Actually, you can arrange the files in any structure that seems logical to you, just as you organize the files into folders or directories on your computer. For example, it might be useful to put all the images in an *images/* directory. Relative references (such as the files referred to in the \\\u003chref\\\u003e element that is used in NetworkLink, Link, Overlay/Icon, and Model) are specified relative to the *doc.kml* file. If you include an images directory, then the \\\u003chref\\\u003e specification for your images would be: *images/myBrickTexture.jpg* , *images/myMountainOverlay.png*, and so on).\n\n[Back to top](#top)"]]