1/**2 * Copyright (c) 2006-2018, JGraph Holdings Ltd3 */45//**********************************************************************************************************************************************************6//double rect7//**********************************************************************************************************************************************************8/**9* Extends mxShape.10*/11function mxShapeGCP2DoubleRect(bounds, fill, stroke, strokewidth)12{13 mxShape.call(this);14 this.bounds = bounds;15 this.fill = fill;16 this.stroke = stroke;17 this.strokewidth = (strokewidth != null) ? strokewidth : 1;18};1920/**21* Extends mxShape.22*/23mxUtils.extend(mxShapeGCP2DoubleRect, mxShape);2425mxShapeGCP2DoubleRect.prototype.cst = {26 SHAPE_DOUBLE_RECT : 'mxgraph.gcp2.doubleRect'27};2829/**30* Function: paintVertexShape31* 32* Paints the vertex shape.33*/34mxShapeGCP2DoubleRect.prototype.paintVertexShape = function(c, x, y, w, h)35{36 var dx = 8;37 var dy = 8;38 39 w = w - dx;40 h = h - dy;41 42 c.translate(x, y);43 c.begin();44 c.roundrect(dx, dy, w , h, 1, 1);45 c.fillAndStroke();46 c.roundrect(0, 0, w, h, 1, 1);47 c.fillAndStroke();48};4950mxCellRenderer.registerShape(mxShapeGCP2DoubleRect.prototype.cst.SHAPE_DOUBLE_RECT, mxShapeGCP2DoubleRect);51mxShapeGCP2DoubleRect.prototype.constraints = mxRectangleShape.prototype.constraints;5253//**********************************************************************************************************************************************************54//hexagonal icon55//**********************************************************************************************************************************************************56/**57* Extends mxShape.58*/59function mxShapeGCP2HexIcon(bounds, fill, stroke, strokewidth)60{61 mxShape.call(this);62 this.bounds = bounds;63 this.fill = fill;64 this.stroke = stroke;65 this.strokewidth = (strokewidth != null) ? strokewidth : 1;66};6768/**69* Extends mxShape.70*/71mxUtils.extend(mxShapeGCP2HexIcon, mxShape);7273mxShapeGCP2HexIcon.prototype.cst = {74 HEX_ICON : 'mxgraph.gcp2.hexIcon'75};7677mxShapeGCP2HexIcon.prototype.customProperties = [78 {name: 'instNum', dispName: 'Number of instances', type: 'int', min: 0, defVal: 0},79 {name: 'prType', dispName: 'Instance Type', defVal: 'standard', type: 'enum', 80 enumList: [{val: 'standard', dispName: 'Standard'}, 81 {val: 'dynamic', dispName: 'Dynamic'}, 82 {val: 'multiple', dispName: 'Multiple'}, 83 {val: 'shared', dispName: 'Shared'}, 84 {val: 'replica', dispName: 'Replica'}, 85 {val: 'dynamic2', dispName: 'Dynamic 2'}, 86 {val: 'dynamic3', dispName: 'Dynamic 3'}, 87 {val: 'highmem', dispName: 'High-Mem'}, 88 {val: 'highcomp', dispName: 'High-Comp'},89 {val: 'backend', dispName: 'Backend'},90 {val: 'input', dispName: 'Input'}]},91 {name: 'prIcon', dispName: 'Instance Icon', defVal: 'compute_engine', type: 'enum', 92 enumList: [{val: 'compute_engine', dispName: 'Compute Engine'}, 93 {val: 'gpu', dispName: 'GPU'},94 {val: 'app_engine', dispName: 'App Engine'},95 {val: 'cloud_functions', dispName: 'Cloud Functions'},96 {val: 'container_engine', dispName: 'Kubernetes Engine'},97 {val: 'container_optimized_os', dispName: 'Container-Optimized OS'},98 {val: 'api_analytics', dispName: 'API Analytics'},99 {val: 'apigee_sense', dispName: 'Apigee Sense'},100 {val: 'api_monetization', dispName: 'API Monetization'},101 {val: 'cloud_endpoints', dispName: 'Cloud Endpoints'},102 {val: 'apigee_api_platform', dispName: 'Apigee API Platform'},103 {val: 'developer_portal', dispName: 'Developer Portal'},104 {val: 'cloud_iam', dispName: 'Cloud IAM'},105 {val: 'beyondcorp', dispName: 'BeyondCorp'},106 {val: 'cloud_iam', dispName: 'Cloud Resource Manager'},107 {val: 'data_loss_prevention_api', dispName: 'Data Loss Prevention API'},108 {val: 'cloud_security_scanner', dispName: 'Cloud Security Scanner'},109 {val: 'key_management_service', dispName: 'Key Management Service'},110 {val: 'identity_aware_proxy', dispName: 'Identity-Aware Proxy'},111 {val: 'security_key_enforcement', dispName: 'Security Key Enforcement'},112 {val: 'bigquery', dispName: 'BigQuery'},113 {val: 'cloud_datalab', dispName: 'Cloud Datalab'},114 {val: 'cloud_dataflow', dispName: 'Cloud Dataflow'},115 {val: 'cloud_pubsub', dispName: 'Cloud Pub/Sub'},116 {val: 'cloud_dataproc', dispName: 'Cloud Dataproc'},117 {val: 'genomics', dispName: 'Genomics'},118 {val: 'cloud_dataprep', dispName: 'Cloud Dataprep'},119 {val: 'data_studio', dispName: 'Data Studio'},120 {val: 'transfer_appliance', dispName: 'Transfer Appliance'},121 {val: 'cloud_machine_learning', dispName: 'Cloud Machine Learning'},122 {val: 'cloud_natural_language_api', dispName: 'Cloud Natural Language API'},123 {val: 'cloud_vision_api', dispName: 'Vision API'},124 {val: 'cloud_translation_api', dispName: 'Translation API'},125 {val: 'cloud_speech_api', dispName: 'Speech API'},126 {val: 'cloud_jobs_api', dispName: 'Jobs API'},127 {val: 'cloud_video_intelligence_api', dispName: 'Cloud Video Intelligence API'},128 {val: 'advanced_solutions_lab', dispName: 'Advanced Solutions Lab'},129 {val: 'cloud_iot_core', dispName: 'Cloud IoT Core'},130 {val: 'cloud_storage', dispName: 'Cloud Storage'},131 {val: 'cloud_sql', dispName: 'Cloud SQL'},132 {val: 'cloud_bigtable', dispName: 'Cloud Bigtable'},133 {val: 'cloud_spanner', dispName: 'Cloud Spanner'},134 {val: 'cloud_datastore', dispName: 'Cloud Datastore'},135 {val: 'persistent_disk', dispName: 'Persistent Disk'},136 {val: 'cloud_memorystore', dispName: 'Cloud Memorystore'},137 {val: 'cloud_filestore', dispName: 'Cloud Filestore'},138 {val: 'stackdriver', dispName: 'Stackdriver'},139 {val: 'cloud_deployment_manager', dispName: 'Monitoring'},140 {val: 'cloud_deployment_manager', dispName: 'Deployment Manager'},141 {val: 'logging', dispName: 'Logging'},142 {val: 'placeholder', dispName: 'Cloud Console'},143 {val: 'error_reporting', dispName: 'Error Reporting'},144 {val: 'placeholder', dispName: 'Cloud Shell'},145 {val: 'trace', dispName: 'Trace'},146 {val: 'placeholder', dispName: 'Cloud Mobile App'},147 {val: 'profiler', dispName: 'Profiler'},148 {val: 'placeholder', dispName: 'Billing API'},149 {val: 'cloud_apis', dispName: 'Cloud APIs'},150 {val: 'virtual_private_cloud', dispName: 'Virtual Private Cloud'},151 {val: 'dedicated_interconnect', dispName: 'Dedicated Interconnect'},152 {val: 'cloud_load_balancing', dispName: 'Cloud Load Balancing'},153 {val: 'cloud_dns', dispName: 'Cloud DNS'},154 {val: 'cloud_cdn', dispName: 'Cloud CDN'},155 {val: 'cloud_network', dispName: 'Cloud Network'},156 {val: 'cloud_external_ip_addresses', dispName: 'Cloud External IP Addresses'},157 {val: 'cloud_routes', dispName: 'Cloud Routes'},158 {val: 'cloud_firewall_rules', dispName: 'Cloud Firewall Rules'},159 {val: 'cloud_vpn', dispName: 'Cloud VPN'},160 {val: 'cloud_router', dispName: 'Cloud Router'},161 {val: 'cloud_armor', dispName: 'Cloud Armor'},162 {val: 'standard_network_tier', dispName: 'Standard Network Tier'},163 {val: 'premium_network_tier', dispName: 'Premium Network Tier'},164 {val: 'partner_interconnect', dispName: 'Partner Interconnect'},165 {val: 'placeholder', dispName: 'Cloud SDK'},166 {val: 'container_builder', dispName: 'Cloud Build'},167 {val: 'cloud_tools_for_powershell', dispName: 'Cloud Tools for Visual Studio'},168 {val: 'placeholder', dispName: 'Cloud Source Repositories'},169 {val: 'placeholder', dispName: 'Maven App Engine Plugin'},170 {val: 'placeholder', dispName: 'Cloud Tools for Eclipse'},171 {val: 'placeholder', dispName: 'Cloud Tools for IntelliJ'},172 {val: 'placeholder', dispName: 'Cloud Test Lab'},173 {val: 'cloud_tools_for_powershell', dispName: 'Cloud Tools for PowerShell'},174 {val: 'cloud_tools_for_powershell', dispName: 'IDE Plugins'},175 {val: 'container_registry', dispName: 'Container Registry'},176 {val: 'cloud_iot_edge', dispName: 'Cloud IoT Edge'},177 {val: 'cloud_firestore', dispName: 'Cloud Firestore'},178 {val: 'cloud_run', dispName: 'Cloud Run'},179 {val: 'gke_on_prem', dispName: 'GKE-on-Prem'},180 {val: 'cloud_data_catalog', dispName: 'Cloud Data Catalog'},181 {val: 'cloud_data_fusion', dispName: 'Cloud Data Fusion'},182 {val: 'ai_hub', dispName: 'AI Hub'},183 {val: 'automl_video_intelligence', dispName: 'AutoML Video Intelligence'},184 {val: 'automl_natural_language', dispName: 'AutoML Natural Language'},185 {val: 'automl_tables', dispName: 'AutoML Tables'},186 {val: 'automl_translation', dispName: 'AutoML Translation'},187 {val: 'automl_vision', dispName: 'AutoML Vision'},188 {val: 'recommendations_ai', dispName: 'Recommendations AI'},189 {val: 'cloud_inference_api', dispName: 'Cloud Inference API'},190 {val: 'cloud_service_mesh', dispName: 'Cloud Service Mesh'},191 {val: 'cloud_nat', dispName: 'Cloud NAT'},192 {val: 'traffic_director', dispName: 'Traffic Director'},193 {val: 'cloud_test_lab', dispName: 'Cloud Test Lab'},194 {val: 'cloud_code', dispName: 'Cloud Code'},195 {val: 'cloud_tasks', dispName: 'Cloud Tasks'},196 {val: 'placeholder', dispName: 'Gradle App Engine Plugin'}]}197];198199/**200* Function: paintVertexShape201* 202* Paints the vertex shape.203*/204mxShapeGCP2HexIcon.prototype.paintVertexShape = function(c, x, y, w, h)205{206 c.translate(x, y);207 208 var prIcon = mxUtils.getValue(this.state.style, 'prIcon', 'compute_engine');209 var prType = mxUtils.getValue(this.state.style, 'prType', '');210 var instNum = parseInt(mxUtils.getValue(this.state.style, 'instNum', 0));211 var fillColor = mxUtils.getValue(this.state.style, 'fillColor', '#ffffff');212 var opacity = mxUtils.getValue(this.state.style, 'opacity', '100');213 var strokeColor = mxUtils.getValue(this.state.style, 'strokeColor', 'none');214 var strokeWidth = mxUtils.getValue(this.state.style, 'strokeWidth', 1);215 var iconSize = Math.min(w, h);216 217 switch(prType)218 {219 case 'dynamic':220 var bgSt1 = mxStencilRegistry.getStencil('mxgraph.gcp2.outline_blank_2');221 c.setAlpha(opacity * 0.5 / 100);222 c.setStrokeColor('none');223 bgSt1.drawShape(c, this, w * 0.21, h * 0.12, w * 0.58, h * 0.76);224 break;225 case 'multiple':226 var bgSt1 = mxStencilRegistry.getStencil('mxgraph.gcp2.outline_blank_2');227 c.setAlpha(opacity * 0.5 / 100);228 c.setStrokeColor('none');229 bgSt1.drawShape(c, this, w * 0.21, h * 0.12, w * 0.58, h * 0.76);230 var bgSt2 = mxStencilRegistry.getStencil('mxgraph.gcp2.outline_blank_3');231 c.setAlpha(opacity * 0.7 / 100);232 c.setStrokeColor('none');233 bgSt2.drawShape(c, this, w * 0.17, h * 0.13, w * 0.66, h * 0.74);234 break;235 case 'shared':236 var bgSt1 = mxStencilRegistry.getStencil('mxgraph.gcp2.outline_blank_1');237 this.style[mxConstants.STYLE_STROKEWIDTH] = iconSize * 0.038;238 c.setAlpha(opacity * 0.4 / 100);239 c.setStrokeColor(fillColor);240 c.setFillColor('none');241 bgSt1.drawShape(c, this, w * 0.02, h * 0, w * 0.96, h);242 var bgSt2 = mxStencilRegistry.getStencil('mxgraph.gcp2.outline_blank_2');243 c.setAlpha(opacity * 0.7 / 100);244 bgSt2.drawShape(c, this, w * 0.14, h * 0.01, w * 0.72, h * 0.98);245 c.setAlpha(opacity / 100);246 c.setFillColor('#ffffff');247 bgSt1.drawShape(c, this, w * 0.13, h * 0.12, w * 0.74, h * 0.76);248 this.style[mxConstants.STYLE_STROKEWIDTH] = strokeWidth;249 break;250 case 'replica':251 var bgSt1 = mxStencilRegistry.getStencil('mxgraph.gcp2.outline_blank_1');252 this.style[mxConstants.STYLE_STROKEWIDTH] = iconSize * 0.038;253 c.setAlpha(opacity * 0.4 / 100);254 c.setStrokeColor(fillColor);255 c.setFillColor('none');256 bgSt1.drawShape(c, this, w * 0.02, h * 0, w * 0.96, h);257 c.setAlpha(opacity * 0.7 / 100);258 bgSt1.drawShape(c, this, w * 0.075, h * 0.06, w * 0.85, h * 0.88);259 c.setAlpha(opacity / 100);260 c.setFillColor('#ffffff');261 bgSt1.drawShape(c, this, w * 0.13, h * 0.12, w * 0.74, h * 0.76);262 this.style[mxConstants.STYLE_STROKEWIDTH] = strokeWidth;263 break;264 case 'dynamic2':265 var bgSt1 = mxStencilRegistry.getStencil('mxgraph.gcp2.outline_blank_2');266 c.setAlpha(opacity * 0.5 / 100);267 c.setStrokeColor('none');268 bgSt1.drawShape(c, this, w * 0.14, h * 0.01, w * 0.72, h * 0.98);269 var bgSt2 = mxStencilRegistry.getStencil('mxgraph.gcp2.outline_blank_1');270 this.style[mxConstants.STYLE_STROKEWIDTH] = iconSize * 0.01;271 c.setStrokeColor(fillColor);272 c.setAlpha(opacity / 100);273 c.setFillColor('#ffffff');274 bgSt2.drawShape(c, this, w * 0.13, h * 0.12, w * 0.74, h * 0.76);275 this.style[mxConstants.STYLE_STROKEWIDTH] = strokeWidth;276 break;277 case 'dynamic3':278 var bgSt1 = mxStencilRegistry.getStencil('mxgraph.gcp2.outline_blank_2');279 c.setStrokeColor('none');280 bgSt1.drawShape(c, this, w * 0.14, h * 0.01, w * 0.72, h * 0.98);281 var bgSt2 = mxStencilRegistry.getStencil('mxgraph.gcp2.outline_blank_1');282 this.style[mxConstants.STYLE_STROKEWIDTH] = iconSize * 0.01;283 c.setStrokeColor(fillColor);284 c.setAlpha(opacity / 100);285 c.setFillColor('#ffffff');286 bgSt2.drawShape(c, this, w * 0.13, h * 0.12, w * 0.74, h * 0.76);287 this.style[mxConstants.STYLE_STROKEWIDTH] = strokeWidth;288 break;289 case 'highmem':290 var bgSt1 = mxStencilRegistry.getStencil('mxgraph.gcp2.outline_highmem');291 c.setAlpha(opacity * 0.5 / 100);292 c.setStrokeColor('none');293 bgSt1.drawShape(c, this, 0, h * 0.56, w, h * 0.28);294 break;295 case 'highcomp':296 var bgSt1 = mxStencilRegistry.getStencil('mxgraph.gcp2.outline_highcomp');297 c.setAlpha(opacity * 0.5 / 100);298 c.setStrokeColor('none');299 bgSt1.drawShape(c, this, 0, h * 0.16, w, h * 0.28);300 break;301 case 'backend':302 var bgSt1 = mxStencilRegistry.getStencil('mxgraph.gcp2.outline_blank_1');303 c.setFillColor('#FCC64D');304 bgSt1.drawShape(c, this, w * 0.12, h * 0.11, w * 0.76, h * 0.78);305 break;306 case 'input':307 var bgSt1 = mxStencilRegistry.getStencil('mxgraph.gcp2.outline_blank_1');308 c.setFillColor('#A5DA40');309 bgSt1.drawShape(c, this, w * 0.12, h * 0.11, w * 0.76, h * 0.78);310 break;311 case 'standard':312 default:313 break;314 }315 316 c.setAlpha(opacity / 100);317 var stencil = mxStencilRegistry.getStencil('mxgraph.gcp2.' + prIcon);318 319 if (stencil != null)320 {321 c.setFillColor(fillColor);322 c.setStrokeColor('none');323 stencil.drawShape(c, this, w * 0.17, h * 0.16, w * 0.66, h * 0.68);324 }325326 if (instNum > 0)327 {328 c.setFillColor('#ffffff');329 c.setStrokeColor('#ffffff');330 c.setStrokeWidth(iconSize * 0.038);331 c.ellipse(w * 0.2, 0, w * 0.18, h * 0.22);332 c.fillAndStroke();333334 c.setAlpha(opacity * 0.5 / 100);335 c.setStrokeColor(fillColor);336 c.ellipse(w * 0.2, 0, w * 0.18, h * 0.22);337 c.stroke();338339 c.setAlpha(opacity / 100);340 c.setFontColor('#4E6B89');341 c.setFontStyle(1);342 c.setFontSize(Math.min(w, h) * 0.1);343 344 c.text(w * 0.29, h * 0.11 + 1, 0, 0, instNum.toString(), mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);345 }346};347348mxCellRenderer.registerShape(mxShapeGCP2HexIcon.prototype.cst.HEX_ICON, mxShapeGCP2HexIcon);349350mxShapeGCP2HexIcon.prototype.getConstraints = function(style, w, h)351{352 var constr = [];353354 constr.push(new mxConnectionConstraint(new mxPoint(0.825, 0.5), false));355 constr.push(new mxConnectionConstraint(new mxPoint(0.175, 0.5), false));356 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0.16), false));357 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0.84), false));358 constr.push(new mxConnectionConstraint(new mxPoint(0.66, 0.17), false));359 constr.push(new mxConnectionConstraint(new mxPoint(0.66, 0.83), false));360 constr.push(new mxConnectionConstraint(new mxPoint(0.34, 0.17), false));361 constr.push(new mxConnectionConstraint(new mxPoint(0.34, 0.83), false));362 constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0.33), false));363 constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0.67), false));364 constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0.33), false));365 constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0.67), false));366367 return (constr);368};369