first commit

This commit is contained in:
CHIEFSOFT\ameye
2024-09-30 18:11:26 -04:00
commit e592ca6823
27270 changed files with 5002257 additions and 0 deletions
File diff suppressed because it is too large Load Diff
+94
View File
@@ -0,0 +1,94 @@
<?php namespace RedeyeVentures\GeoPattern;
use RedeyeVentures\GeoPattern\SVGElements\Group;
use RedeyeVentures\GeoPattern\SVGElements\Polyline;
use RedeyeVentures\GeoPattern\SVGElements\Rectangle;
use RedeyeVentures\GeoPattern\SVGElements\Circle;
use RedeyeVentures\GeoPattern\SVGElements\Path;
class SVG {
protected $width;
protected $height;
protected $svgString;
function __construct($options=array())
{
$this->width = 100;
$this->height = 100;
$this->svgString = '';
}
public function setWidth($width)
{
$this->width = floor($width);
return $this;
}
public function setHeight($height)
{
$this->height = floor($height);
return $this;
}
protected function getSvgHeader()
{
return "<?xml version=\"1.0\"?><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"{$this->width}\" height=\"{$this->height}\">";
}
protected function getSvgFooter()
{
return '</svg>';
}
public function addRectangle($x, $y, $width, $height, $args=array())
{
$rectangle = new Rectangle($x, $y, $width, $height, $args);
$this->svgString .= $rectangle;
return $this;
}
public function addCircle($cx, $cy, $r, $args=array())
{
$circle = new Circle($cx, $cy, $r, $args);
$this->svgString .= $circle;
return $this;
}
public function addPath($d, $args=array())
{
$path = new Path($d, $args);
$this->svgString .= $path;
return $this;
}
public function addPolyline($points, $args=array())
{
$polyline = new Polyline($points, $args);
$this->svgString .= $polyline;
return $this;
}
public function addGroup($group, $args=array())
{
if ($group instanceof Group)
{
$group->setArgs($args);
$this->svgString .= $group;
return $this;
}
throw new \InvalidArgumentException("The group provided is not a valid instance of Group.");
}
public function getString()
{
return $this->getSvgHeader().$this->svgString.$this->getSvgFooter();
}
public function __toString()
{
return $this->getString();
}
}
@@ -0,0 +1,55 @@
<?php namespace RedeyeVentures\GeoPattern\SVGElements;
abstract class Base
{
protected $tag;
protected $elements;
protected $args;
function __construct($args)
{
$this->args = $args;
}
public function elementsToString()
{
$string = ' ';
foreach ($this->elements as $key => $value)
{
$string .= "$key=\"$value\" ";
}
return $string;
}
public function argsToString()
{
$string = '';
foreach ($this->args as $key => $value)
{
if (is_array($value))
{
$string .= "$key=\"";
foreach ($value as $k => $v)
{
$string .= "$k:$v;";
}
$string .= '" ';
}
else
{
$string .= "$key=\"$value\" ";
}
}
return $string;
}
public function getString()
{
return "<{$this->tag}{$this->elementsToString()}{$this->argsToString()}/>";
}
function __toString()
{
return $this->getString();
}
}
@@ -0,0 +1,16 @@
<?php namespace RedeyeVentures\GeoPattern\SVGElements;
class Circle extends Base
{
protected $tag = 'circle';
function __construct($cx, $cy, $r, $args=array())
{
$this->elements = [
'cx' => $cx,
'cy' => $cy,
'r' => $r,
];
parent::__construct($args);
}
}
@@ -0,0 +1,38 @@
<?php namespace RedeyeVentures\GeoPattern\SVGElements;
class Group extends Base
{
protected $tag = 'g';
protected $items;
function __construct($items=array(), $args=array())
{
$this->items = $items;
$this->args = $args;
}
function addItem($item)
{
$this->items[] = $item;
return $this;
}
function setArgs($args)
{
$this->args = $args;
return $this;
}
function getString()
{
$svgString = '';
$svgString .= "<{$this->tag} {$this->argsToString($this->args)}>";
foreach ($this->items as $item)
{
$svgString .= $item;
}
$svgString .= "</{$this->tag}>";
return $svgString;
}
}
@@ -0,0 +1,14 @@
<?php namespace RedeyeVentures\GeoPattern\SVGElements;
class Path extends Base
{
protected $tag = 'path';
function __construct($d, $args=array())
{
$this->elements = [
'd' => $d,
];
parent::__construct($args);
}
}
@@ -0,0 +1,14 @@
<?php namespace RedeyeVentures\GeoPattern\SVGElements;
class Polyline extends Base
{
protected $tag = 'polyline';
function __construct($points, $args=array())
{
$this->elements = [
'points' => $points,
];
parent::__construct($args);
}
}
@@ -0,0 +1,17 @@
<?php namespace RedeyeVentures\GeoPattern\SVGElements;
class Rectangle extends Base
{
protected $tag = 'rect';
function __construct($x, $y, $width, $height, $args=array())
{
$this->elements = [
'x' => $x,
'y' => $y,
'width' => $width,
'height' => $height,
];
parent::__construct($args);
}
}
+20
View File
@@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2014 Redeye Ventures
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+12
View File
@@ -0,0 +1,12 @@
GeoPattern-PHP
-------
Downloaded from: https://github.com/RedeyeGroup/geopattern-php
Import procedure:
- Copy all the files from the folder 'src' this directory.
- Copy the license file from the project root.
- Remove the geopattern_loader.php file from the src directory, it is not needed.
Licensed under MIT, Copyright (c) 2015 Leaf Corcoran.