অঙ্কন স্তর (লাইব্রেরি)
সেভ করা পৃষ্ঠা গুছিয়ে রাখতে 'সংগ্রহ' ব্যবহার করুন
আপনার পছন্দ অনুযায়ী কন্টেন্ট সেভ করুন ও সঠিক বিভাগে রাখুন।
- ওভারভিউ
- লাইব্রেরি ব্যবহার করে
- ড্রয়িং ম্যানেজার বিকল্প
- অঙ্কন সরঞ্জাম নিয়ন্ত্রণ আপডেট করা হচ্ছে
- ইভেন্ট অঙ্কন
ওভারভিউ
DrawingManager
ক্লাস ব্যবহারকারীদের মানচিত্রে বহুভুজ, আয়তক্ষেত্র, পলিলাইন, বৃত্ত এবং মার্কার আঁকার জন্য একটি গ্রাফিকাল ইন্টারফেস প্রদান করে।
লাইব্রেরি ব্যবহার করে
অঙ্কন সরঞ্জাম হল একটি স্বয়ংসম্পূর্ণ লাইব্রেরি, প্রধান মানচিত্র API জাভাস্ক্রিপ্ট কোড থেকে আলাদা। এই লাইব্রেরির মধ্যে থাকা কার্যকারিতা ব্যবহার করতে, আপনাকে প্রথমে মানচিত্র API বুটস্ট্র্যাপ URL-এ libraries
প্যারামিটার ব্যবহার করে এটি লোড করতে হবে:
<script async
src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&loading=async&libraries=drawing&callback=initMap">
</script>
একবার আপনি লাইব্রেরি প্যারামিটার যোগ করলে, আপনি নিম্নরূপ একটি DrawingManager
অবজেক্ট তৈরি করতে পারেন:
var drawingManager = new google.maps.drawing.DrawingManager();
drawingManager.setMap(map);
ড্রয়িং ম্যানেজার বিকল্প
DrawingManager
কনস্ট্রাক্টর বিকল্পগুলির একটি সেট নেয় যা প্রদর্শনের জন্য নিয়ন্ত্রণের সেট, নিয়ন্ত্রণের অবস্থান এবং প্রাথমিক অঙ্কন অবস্থাকে সংজ্ঞায়িত করে।
-
DrawingManager
এর drawingMode
বৈশিষ্ট্য DrawingManager-এর প্রাথমিক অঙ্কন অবস্থা সংজ্ঞায়িত করে। এটি একটি google.maps.drawing.OverlayType
ধ্রুবক গ্রহণ করে। ডিফল্ট হল null
, যে ক্ষেত্রে ড্রয়িং ম্যানেজার আরম্ভ করার সময় কার্সারটি একটি নন-ড্রয়িং মোডে থাকে। -
DrawingManager
drawingControl
বৈশিষ্ট্য মানচিত্রে অঙ্কন সরঞ্জাম নির্বাচন ইন্টারফেসের দৃশ্যমানতা নির্ধারণ করে। এটি একটি বুলিয়ান মান গ্রহণ করে। - এছাড়াও আপনি নিয়ন্ত্রণের অবস্থান নির্ধারণ করতে পারেন এবং
DrawingManager
-এর drawingControlOptions
বৈশিষ্ট্য ব্যবহার করে নিয়ন্ত্রণে উপস্থাপিত হওয়া ওভারলেগুলির প্রকারগুলিও নির্ধারণ করতে পারেন।-
position
মানচিত্রে অঙ্কন নিয়ন্ত্রণের অবস্থান নির্ধারণ করে এবং একটি google.maps.ControlPosition
ধ্রুবক গ্রহণ করে। -
drawingModes
হল google.maps.drawing.OverlayType
ধ্রুবকগুলির একটি অ্যারে, এবং অঙ্কন নিয়ন্ত্রণ আকৃতি পিকারে অন্তর্ভুক্ত করার জন্য ওভারলে প্রকারগুলিকে সংজ্ঞায়িত করে৷ হ্যান্ড আইকনটি সর্বদা উপস্থিত থাকবে, ব্যবহারকারীকে অঙ্কন ছাড়াই মানচিত্রের সাথে ইন্টারঅ্যাক্ট করতে দেয়। কন্ট্রোলে থাকা টুলগুলির ক্রমটি অ্যারেতে ঘোষিত ক্রম অনুসারে মিলবে।
- প্রতিটি ধরণের ওভারলেকে ডিফল্ট বৈশিষ্ট্যের একটি সেট বরাদ্দ করা যেতে পারে, যা প্রথম তৈরি করার সময় ওভারলেটির উপস্থিতি নির্ধারণ করে। এই ওভারলে এর
{overlay}Options
বৈশিষ্ট্যে সংজ্ঞায়িত করা হয়েছে (যেখানে {overlay}
ওভারলে প্রকারের প্রতিনিধিত্ব করে)। উদাহরণস্বরূপ, একটি বৃত্তের ভরাট বৈশিষ্ট্য, স্ট্রোক বৈশিষ্ট্য, zIndex এবং ক্লিকযোগ্যতা circleOptions
বৈশিষ্ট্য দ্বারা সংজ্ঞায়িত করা যেতে পারে। কোনো আকার, অবস্থান, বা মানচিত্রের মান পাস করা হলে, সেগুলি উপেক্ষা করা হয়। কোন বৈশিষ্ট্যগুলি সেট করা যেতে পারে তার সম্পূর্ণ বিবরণের জন্য, API রেফারেন্স ডকুমেন্টেশন দেখুন।
দ্রষ্টব্য: এটি তৈরি হওয়ার পরে একটি আকৃতি ব্যবহারকারী-সম্পাদনাযোগ্য করতে, এটির editable
সম্পত্তি true
সেট করুন।
একবার DrawingManager
অবজেক্ট তৈরি হয়ে গেলে, আপনি setOptions()
কল করে এবং নতুন মান পাস করে এটি আপডেট করতে পারেন।
drawingManager.setOptions({
drawingControlOptions: {
position: google.maps.ControlPosition.BOTTOM_LEFT,
drawingModes: ['marker']
}
});
অঙ্কন সরঞ্জাম নিয়ন্ত্রণ লুকাতে বা দেখানোর জন্য:
// To hide:
drawingManager.setOptions({
drawingControl: false
});
// To show:
drawingManager.setOptions({
drawingControl: true
});
map
বস্তু থেকে অঙ্কন সরঞ্জাম নিয়ন্ত্রণ সরাতে:
drawingManager.setMap(null);
ড্রয়িং কন্ট্রোল লুকিয়ে রাখলে ড্রয়িং টুল কন্ট্রোল ডিসপ্লে হয় না, কিন্তু DrawingManager
ক্লাসের সমস্ত কার্যকারিতা এখনও পাওয়া যায়। এইভাবে, আপনি চাইলে আপনার নিজের নিয়ন্ত্রণ বাস্তবায়ন করতে পারেন। map
বস্তু থেকে DrawingManager
অপসারণ সমস্ত অঙ্কন কার্যকারিতা নিষ্ক্রিয় করে; অঙ্কন বৈশিষ্ট্যগুলি পুনরুদ্ধার করতে হলে এটি অবশ্যই drawingManager.setMap(map)
এর সাথে মানচিত্রের সাথে পুনরায় সংযুক্ত করতে হবে, অথবা একটি নতুন DrawingManager
অবজেক্ট তৈরি করতে হবে।
ইভেন্ট অঙ্কন
যখন একটি আকৃতি ওভারলে তৈরি করা হয়, তখন দুটি ইভেন্ট চালিত হয়:
- একটি
{overlay}complete
ইভেন্ট (যেখানে {overlay}
ওভারলে প্রকারকে প্রতিনিধিত্ব করে, যেমন circlecomplete
, polygoncomplete
ইত্যাদি)। ওভারলে একটি রেফারেন্স একটি যুক্তি হিসাবে পাস করা হয়. - একটি
overlaycomplete
ইভেন্ট। একটি বস্তু আক্ষরিক, OverlayType
এবং ওভারলে একটি রেফারেন্স ধারণকারী, একটি যুক্তি হিসাবে পাস করা হয়.
google.maps.event.addListener(drawingManager, 'circlecomplete', function(circle) {
var radius = circle.getRadius();
});
google.maps.event.addListener(drawingManager, 'overlaycomplete', function(event) {
if (event.type == 'circle') {
var radius = event.overlay.getRadius();
}
});
মনে রাখবেন google.maps.Map
ইভেন্টগুলি, যেমন click
এবং mousemove
ম্যাপে আঁকার সময় অক্ষম থাকে৷
অন্য কিছু উল্লেখ না করা থাকলে, এই পৃষ্ঠার কন্টেন্ট Creative Commons Attribution 4.0 License-এর অধীনে এবং কোডের নমুনাগুলি Apache 2.0 License-এর অধীনে লাইসেন্স প্রাপ্ত। আরও জানতে, Google Developers সাইট নীতি দেখুন। Java হল Oracle এবং/অথবা তার অ্যাফিলিয়েট সংস্থার রেজিস্টার্ড ট্রেডমার্ক।
2025-08-06 UTC-তে শেষবার আপডেট করা হয়েছে।
[null,null,["2025-08-06 UTC-তে শেষবার আপডেট করা হয়েছে।"],[[["\u003cp\u003eThe \u003ccode\u003eDrawingManager\u003c/code\u003e class in the Google Maps JavaScript API enables users to draw shapes like polygons, circles, and markers directly on the map.\u003c/p\u003e\n"],["\u003cp\u003eTo utilize the Drawing Tools, include the \u003ccode\u003elibraries=drawing\u003c/code\u003e parameter in the Maps API bootstrap URL when loading the API.\u003c/p\u003e\n"],["\u003cp\u003eCustomize the drawing experience by configuring options like \u003ccode\u003edrawingMode\u003c/code\u003e, \u003ccode\u003edrawingControl\u003c/code\u003e, and shape-specific properties using the \u003ccode\u003eDrawingManager\u003c/code\u003e constructor and \u003ccode\u003esetOptions()\u003c/code\u003e method.\u003c/p\u003e\n"],["\u003cp\u003eDrawing events such as \u003ccode\u003e{overlay}complete\u003c/code\u003e and \u003ccode\u003eoverlaycomplete\u003c/code\u003e are triggered when shapes are created, providing access to the drawn overlay for further manipulation.\u003c/p\u003e\n"],["\u003cp\u003eWhile drawing is active, standard Google Maps events like \u003ccode\u003eclick\u003c/code\u003e and \u003ccode\u003emousemove\u003c/code\u003e are temporarily disabled on the map.\u003c/p\u003e\n"]]],[],null,["1. [Overview](#overview)\n2. [Using the Library](#using_the_library)\n3. [DrawingManager Options](#drawingmanager_options)\n4. [Updating the Drawing Tools Control](#updating_the_drawing_tools_control)\n5. [Drawing Events](#drawing_events)\n\nOverview\n\nThe `DrawingManager` class provides a graphical interface for users to draw\npolygons, rectangles, polylines, circles, and markers on the map.\n\nUsing the Library\n\nThe Drawing Tools are a self-contained library, separate from the main Maps\nAPI JavaScript code. To use the functionality contained within this library,\nyou must first load it using the [`libraries`](/maps/documentation/javascript/libraries) parameter in the\nMaps API bootstrap URL: \n\n```html\n\u003cscript async\n src=\"https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&loading=async&libraries=drawing&callback=initMap\"\u003e\n\u003c/script\u003e\n```\n\nOnce you've added the libraries parameter, you can create a `DrawingManager`\nobject as follows: \n\n```javascript\nvar drawingManager = new google.maps.drawing.DrawingManager();\ndrawingManager.setMap(map);\n```\n\nDrawingManager Options\n\nThe `DrawingManager` constructor takes a set of options that define the set of\ncontrols to display, the position of the control, and the initial drawing\nstate.\n\n- The `drawingMode` property of the `DrawingManager` defines the initial drawing state of the DrawingManager. It accepts a [`google.maps.drawing.OverlayType`](/maps/documentation/javascript/reference#OverlayType) constant. Default is `null`, in which case the cursor is in a non-drawing mode when the DrawingManager is initialized.\n- The `drawingControl` property of the `DrawingManager` defines the visibility of the drawing tools selection interface on the map. It accepts a boolean value.\n- You can also define the position of the control, and the types of overlays that should be represented in the control, using the `drawingControlOptions` property of the `DrawingManager`.\n - `position` defines the position of the drawing control on the map, and accepts a [`google.maps.ControlPosition`](/maps/documentation/javascript/reference#ControlPosition) constant.\n - `drawingModes` is an array of [`google.maps.drawing.OverlayType`](/maps/documentation/javascript/reference#OverlayType) constants, and defines the overlay types to include in the drawing control shape picker. The hand icon will always be present, allowing the user to interact with the map without drawing. The order of the tools in the control will match the order in which they are declared in the array.\n- Each type of overlay can be assigned a set of default properties, that define the appearance of the overlay when first created. These are defined in that overlay's `{overlay}Options` property (where `{overlay}` represents the overlay type). For example, a circle's fill properties, stroke properties, zIndex, and clickability can be defined with the `circleOptions` property. If any size, location, or map values are passed, they are ignored. For full details of which properties can be set, refer to the [API Reference documentation](/maps/documentation/javascript/reference#DrawingManagerOptions).\n\n**Note:** To make a shape [user-editable](/maps/documentation/javascript/shapes#editable) after it has\nbeen created, set its `editable` property to `true`. \n\nTypeScript \n\n```typescript\n// This example requires the Drawing library. Include the libraries=drawing\n// parameter when you first load the API. For example:\n// \u003cscript src=\"https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&libraries=drawing\"\u003e\n\nfunction initMap(): void {\n const map = new google.maps.Map(\n document.getElementById(\"map\") as HTMLElement,\n {\n center: { lat: -34.397, lng: 150.644 },\n zoom: 8,\n }\n );\n\n const drawingManager = new google.maps.drawing.DrawingManager({\n drawingMode: google.maps.drawing.OverlayType.MARKER,\n drawingControl: true,\n drawingControlOptions: {\n position: google.maps.ControlPosition.TOP_CENTER,\n drawingModes: [\n google.maps.drawing.OverlayType.MARKER,\n google.maps.drawing.OverlayType.CIRCLE,\n google.maps.drawing.OverlayType.POLYGON,\n google.maps.drawing.OverlayType.POLYLINE,\n google.maps.drawing.OverlayType.RECTANGLE,\n ],\n },\n markerOptions: {\n icon: \"https://developers.google.com/maps/documentation/javascript/examples/full/images/beachflag.png\",\n },\n circleOptions: {\n fillColor: \"#ffff00\",\n fillOpacity: 1,\n strokeWeight: 5,\n clickable: false,\n editable: true,\n zIndex: 1,\n },\n });\n\n drawingManager.setMap(map);\n}\n\ndeclare global {\n interface Window {\n initMap: () =\u003e void;\n }\n}\nwindow.initMap = initMap;https://github.com/googlemaps/js-samples/blob/2683f7366fb27829401945d2a7e27d77ed2df8e5/samples/drawing-tools/index.ts#L8-L55\n```\n| **Note:** Read the [guide](/maps/documentation/javascript/using-typescript) on using TypeScript and Google Maps.\n\nJavaScript \n\n```javascript\n// This example requires the Drawing library. Include the libraries=drawing\n// parameter when you first load the API. For example:\n// \u003cscript src=\"https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&libraries=drawing\"\u003e\nfunction initMap() {\n const map = new google.maps.Map(document.getElementById(\"map\"), {\n center: { lat: -34.397, lng: 150.644 },\n zoom: 8,\n });\n const drawingManager = new google.maps.drawing.DrawingManager({\n drawingMode: google.maps.drawing.OverlayType.MARKER,\n drawingControl: true,\n drawingControlOptions: {\n position: google.maps.ControlPosition.TOP_CENTER,\n drawingModes: [\n google.maps.drawing.OverlayType.MARKER,\n google.maps.drawing.OverlayType.CIRCLE,\n google.maps.drawing.OverlayType.POLYGON,\n google.maps.drawing.OverlayType.POLYLINE,\n google.maps.drawing.OverlayType.RECTANGLE,\n ],\n },\n markerOptions: {\n icon: \"https://developers.google.com/maps/documentation/javascript/examples/full/images/beachflag.png\",\n },\n circleOptions: {\n fillColor: \"#ffff00\",\n fillOpacity: 1,\n strokeWeight: 5,\n clickable: false,\n editable: true,\n zIndex: 1,\n },\n });\n\n drawingManager.setMap(map);\n}\n\nwindow.initMap = initMap;https://github.com/googlemaps/js-samples/blob/2683f7366fb27829401945d2a7e27d77ed2df8e5/dist/samples/drawing-tools/docs/index.js#L7-L44\n```\n| **Note:** The JavaScript is compiled from the TypeScript snippet.\n[View example](/maps/documentation/javascript/examples/drawing-tools)\n\nTry Sample \n[JSFiddle.net](https://jsfiddle.net/gh/get/library/pure/googlemaps/js-samples/tree/master/dist/samples/drawing-tools/jsfiddle) [Google Cloud Shell](https://ssh.cloud.google.com/cloudshell/editor?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fgooglemaps%2Fjs-samples&cloudshell_git_branch=sample-drawing-tools&cloudshell_tutorial=cloud_shell_instructions.md&cloudshell_workspace=.)\n\nUpdating the Drawing Tools Control\n\nOnce the `DrawingManager` object has been created, you can update it by\ncalling `setOptions()` and passing new values. \n\n```javascript\ndrawingManager.setOptions({\n drawingControlOptions: {\n position: google.maps.ControlPosition.BOTTOM_LEFT,\n drawingModes: ['marker']\n }\n});\n```\n\nTo hide or show the drawing tools control: \n\n```javascript\n// To hide:\ndrawingManager.setOptions({\n drawingControl: false\n});\n\n// To show:\ndrawingManager.setOptions({\n drawingControl: true\n});\n```\n\nTo remove the drawing tools control from the `map` object: \n\n```javascript\ndrawingManager.setMap(null);\n```\n\n*Hiding* the drawing control causes the drawing tools control to not display,\nbut all of the functionality of the `DrawingManager` class is still available.\nIn this way, you can implement your own control, if desired. *Removing* the\n`DrawingManager` from the `map` object disables all drawing functionality; it\nmust be reattached to the map with `drawingManager.setMap(map)`, or a new\n`DrawingManager` object constructed, if drawing features are to be restored.\n\nDrawing Events\n\nWhen a shape overlay is created, two events are fired:\n\n- An `{overlay}complete` event (where `{overlay}` represents the overlay type, such as `circlecomplete`, `polygoncomplete`, etc). A reference to the overlay is passed as an argument.\n- An `overlaycomplete` event. An object literal, containing the `OverlayType` and a reference to the overlay, is passed as an argument.\n\n```javascript\ngoogle.maps.event.addListener(drawingManager, 'circlecomplete', function(circle) {\n var radius = circle.getRadius();\n});\n\ngoogle.maps.event.addListener(drawingManager, 'overlaycomplete', function(event) {\n if (event.type == 'circle') {\n var radius = event.overlay.getRadius();\n }\n});\n```\n\nNote that [`google.maps.Map`](/maps/documentation/javascript/reference#Map)\nevents, such as `click` and `mousemove` are disabled while drawing on the map."]]