Алгоритм расчета координат для редактора - PHP Online

Form of PHP Sandbox

Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php in the places where the PHP script should be executed.

Name: Алгоритм расчета координат для редактора fullscreencopydownloadembedprint


Your result can be seen below.

Result of php executing





Full code of Алгоритм расчета координат для редактора.php

  1. <?php
  2.  
  3. $coefficient = 200;
  4.  
  5. $levels = [
  6.     0 => [
  7.         "sector_id" => 61,
  8.         "name" => "Parter 1",
  9.         "position" => [
  10.             "radius"=> 0,
  11.             "x" => 0,
  12.             "y"=> 0
  13.         ],
  14.         "controlPoints" => [
  15.             [
  16.                 "radius" => 0,
  17.                 "x" => 198,
  18.                 "y" => 120
  19.             ],
  20.             [
  21.                 "radius" => 0,
  22.                 "x" => 198,
  23.                 "y" => 173
  24.             ],
  25.             [
  26.                 "radius" => 0,
  27.                 "x" => 198,
  28.                 "y" => 227
  29.             ],
  30.             [
  31.                 "radius" => 0,
  32.                 "x" => 198,
  33.                 "y" => 281
  34.             ],
  35.             [
  36.                 "radius" => 0,
  37.                 "x" => 216,
  38.                 "y" => 281
  39.             ],
  40.             [
  41.                 "radius" => 0,
  42.                 "x" => 235,
  43.                 "y" => 281
  44.             ],
  45.             [
  46.                 "radius" => 0,
  47.                 "x" => 254,
  48.                 "y" => 282
  49.             ],
  50.             [
  51.                 "radius" => 0,
  52.                 "x" => 254,
  53.                 "y" => 120
  54.             ],
  55.             [
  56.                 "radius" => 0,
  57.                 "x" => 198,
  58.                 "y" => 120
  59.             ],
  60.             [
  61.                 "radius" => 0,
  62.                 "x" => 198,
  63.                 "y" => 120
  64.             ]
  65.         ],
  66.     ],
  67.     1 => [
  68.         "sector_id" => 68,
  69.         "name" => "Balkon 2 top",
  70.         "position" => [
  71.             "radius"=> 0,
  72.             "x" => 0,
  73.             "y"=> 0
  74.         ],
  75.         "controlPoints" => [
  76.             [
  77.                 "radius" => 0,
  78.                 "x" => 240,
  79.                 "y" => 76
  80.             ],
  81.             [
  82.                 "radius" => 0,
  83.                 "x" => 240,
  84.                 "y" => 80
  85.             ],
  86.             [
  87.                 "radius" => 0,
  88.                 "x" => 240,
  89.                 "y" => 83
  90.             ],
  91.             [
  92.                 "radius" => 0,
  93.                 "x" => 240,
  94.                 "y" => 86
  95.             ],
  96.             [
  97.                 "radius" => 0,
  98.                 "x" => 266,
  99.                 "y" => 86
  100.             ],
  101.             [
  102.                 "radius" => 0,
  103.                 "x" => 291,
  104.                 "y" => 86
  105.             ],
  106.             [
  107.                 "radius" => 0,
  108.                 "x" => 317,
  109.                 "y" => 86
  110.             ],
  111.             [
  112.                 "radius" => 0,
  113.                 "x" => 317,
  114.                 "y" => 76
  115.             ],
  116.             [
  117.                 "radius" => 0,
  118.                 "x" => 240,
  119.                 "y" => 76
  120.             ],
  121.             [
  122.                 "radius" => 0,
  123.                 "x" => 240,
  124.                 "y" => 76
  125.             ]
  126.         ],
  127.     ],
  128.     2 => [
  129.         "sector_id" => 79,
  130.         "name" => "Balkon 3 S2",
  131.         "position" => [
  132.             "radius"=> 0,
  133.             "x" => 0,
  134.             "y"=> 0
  135.         ],
  136.         "controlPoints" => [
  137.             [
  138.                 "radius" => 0,
  139.                 "x" => 384,
  140.                 "y" => 389
  141.             ],
  142.             [
  143.                 "radius" => 0,
  144.                 "x" => 341,
  145.                 "y" => 357
  146.             ],
  147.             [
  148.                 "radius" => 0,
  149.                 "x" => 382,
  150.                 "y" => 300
  151.             ],
  152.             [
  153.                 "radius" => 0,
  154.                 "x" => 426,
  155.                 "y" => 331
  156.             ],
  157.         ],
  158.     ],
  159. ];
  160.  
  161. $places = [
  162.     0 => [
  163.         "additional_properties" => [
  164.             "row" => "1",
  165.             "place_name" => "1",
  166.             "place_count" => 1,
  167.             "price_type" => 1,
  168.             "sector_id" => 63
  169.         ],
  170.         "position" => [
  171.             "radius" => 0,
  172.             "x" => 40,
  173.             "y" => 40
  174.         ],
  175.     ],
  176.     1 => [
  177.         "additional_properties" => [
  178.             "row" => "1",
  179.             "place_name" => "2",
  180.             "place_count" => 1,
  181.             "price_type" => 1,
  182.             "sector_id" => 63
  183.         ],
  184.         "position" => [
  185.             "radius" => 0,
  186.             "x" => 60,
  187.             "y" => 40
  188.         ],
  189.     ],
  190.     2 => [
  191.         "additional_properties" => [
  192.             "row" => "1",
  193.             "place_name" => "3",
  194.             "place_count" => 1,
  195.             "price_type" => 1,
  196.             "sector_id" => 63
  197.         ],
  198.         "position" => [
  199.             "radius" => 0,
  200.             "x" => 80,
  201.             "y" => 40
  202.         ],
  203.     ],
  204.     3 => [
  205.         "additional_properties" => [
  206.             "row" => "1",
  207.             "place_name" => "4",
  208.             "place_count" => 1,
  209.             "price_type" => 1,
  210.             "sector_id" => 63
  211.         ],
  212.         "position" => [
  213.             "radius" => 0,
  214.             "x" => 100,
  215.             "y" => 40
  216.         ],
  217.     ],
  218.     4 => [
  219.         "additional_properties" => [
  220.             "row" => "1",
  221.             "place_name" => "5",
  222.             "place_count" => 1,
  223.             "price_type" => 1,
  224.             "sector_id" => 63
  225.         ],
  226.         "position" => [
  227.             "radius" => 0,
  228.             "x" => 120,
  229.             "y" => 40
  230.         ],
  231.     ],
  232. ];
File Description
  • Алгоритм расчета координат для редактора
  • PHP Code
  • 15 Sep-2023
  • 4.97 Kb
You can Share it: