<?php

/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 2.0.12
 *
 * This file is not intended to be easily readable and contains a number of
 * coding conventions designed to improve portability and efficiency. Do not make
 * changes to this file unless you know what you are doing--modify the SWIG
 * interface file instead.
 * ----------------------------------------------------------------------------- */

// Try to load our extension if it's not already loaded.
if (!extension_loaded('gnm')) {
  if (strtolower(substr(PHP_OS, 0, 3)) === 'win') {
    if (!dl('php_gnm.dll')) return;
  } else {
    // PHP_SHLIB_SUFFIX gives 'dylib' on MacOS X but modules are 'so'.
    if (PHP_SHLIB_SUFFIX === 'dylib') {
      if (!dl('gnm.so')) return;
    } else {
      if (!dl('gnm.'.PHP_SHLIB_SUFFIX)) return;
    }
  }
}



abstract class gnm {
	const GATDijkstraShortestPath = 1;

	const GATKShortestPath = 2;

	const GATConnectedComponents = 3;

	const GNM_EDGE_DIR_BOTH = GNM_EDGE_DIR_BOTH;

	const GNM_EDGE_DIR_SRCTOTGT = GNM_EDGE_DIR_SRCTOTGT;

	const GNM_EDGE_DIR_TGTTOSRC = GNM_EDGE_DIR_TGTTOSRC;

	static function CastToNetwork($base) {
		$r=CastToNetwork($base);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new Network($r);
		}
		return $r;
	}

	static function CastToGenericNetwork($base) {
		$r=CastToGenericNetwork($base);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new GenericNetwork($r);
		}
		return $r;
	}
}

/* PHP Proxy Classes */
class MajorObject {
	public $_cPtr=null;
	protected $_pData=array();

	function __set($var,$value) {
		if ($var === 'thisown') return swig_gnm_alter_newobject($this->_cPtr,$value);
		$this->_pData[$var] = $value;
	}

	function __isset($var) {
		if ($var === 'thisown') return true;
		return array_key_exists($var, $this->_pData);
	}

	function __get($var) {
		if ($var === 'thisown') return swig_gnm_get_newobject($this->_cPtr);
		return $this->_pData[$var];
	}
	function __construct($h) {
		$this->_cPtr=$h;
	}

	function GetDescription() {
		return MajorObject_GetDescription($this->_cPtr);
	}

	function SetDescription($pszNewDesc) {
		MajorObject_SetDescription($this->_cPtr,$pszNewDesc);
	}

	function GetMetadataDomainList() {
		return MajorObject_GetMetadataDomainList($this->_cPtr);
	}

	function GetMetadata_Dict($pszDomain="") {
		return MajorObject_GetMetadata_Dict($this->_cPtr,$pszDomain);
	}

	function GetMetadata_List($pszDomain="") {
		return MajorObject_GetMetadata_List($this->_cPtr,$pszDomain);
	}

	function SetMetadata($papszMetadata_or_pszMetadataString,$pszDomain="") {
		$r=MajorObject_SetMetadata($this->_cPtr,$papszMetadata_or_pszMetadataString,$pszDomain);
		return $r;
	}

	function GetMetadataItem($pszName,$pszDomain="") {
		return MajorObject_GetMetadataItem($this->_cPtr,$pszName,$pszDomain);
	}

	function SetMetadataItem($pszName,$pszValue,$pszDomain="") {
		return MajorObject_SetMetadataItem($this->_cPtr,$pszName,$pszValue,$pszDomain);
	}
}

class Network extends MajorObject {
	public $_cPtr=null;

	function __set($var,$value) {
		if ($var === 'thisown') return swig_gnm_alter_newobject($this->_cPtr,$value);
		MajorObject::__set($var,$value);
	}

	function __isset($var) {
		if ($var === 'thisown') return true;
		return MajorObject::__isset($var);
	}

	function __get($var) {
		if ($var === 'thisown') return swig_gnm_get_newobject($this->_cPtr);
		return MajorObject::__get($var);
	}
	function __construct($h) {
		$this->_cPtr=$h;
	}

	function ReleaseResultSet($layer) {
		Network_ReleaseResultSet($this->_cPtr,$layer);
	}

	function GetVersion() {
		return Network_GetVersion($this->_cPtr);
	}

	function GetName() {
		return Network_GetName($this->_cPtr);
	}

	function GetFeatureByGlobalFID($GFID) {
		return Network_GetFeatureByGlobalFID($this->_cPtr,$GFID);
	}

	function GetPath($nStartFID,$nEndFID,$eAlgorithm,$options=null) {
		return Network_GetPath($this->_cPtr,$nStartFID,$nEndFID,$eAlgorithm,$options);
	}

	function DisconnectAll() {
		return Network_DisconnectAll($this->_cPtr);
	}

	function GetProjection() {
		return Network_GetProjection($this->_cPtr);
	}

	function GetProjectionRef() {
		return Network_GetProjectionRef($this->_cPtr);
	}

	function GetFileList() {
		return Network_GetFileList($this->_cPtr);
	}

	function CreateLayer($name,$srs=null,$geom_type=null,$options=null) {
		switch (func_num_args()) {
		case 1: case 2: $r=Network_CreateLayer($this->_cPtr,$name,$srs); break;
		default: $r=Network_CreateLayer($this->_cPtr,$name,$srs,$geom_type,$options);
		}
		return $r;
	}

	function CopyLayer($src_layer,$new_name,$options=null) {
		return Network_CopyLayer($this->_cPtr,$src_layer,$new_name,$options);
	}

	function DeleteLayer($index) {
		return Network_DeleteLayer($this->_cPtr,$index);
	}

	function GetLayerCount() {
		return Network_GetLayerCount($this->_cPtr);
	}

	function GetLayerByIndex($index=0) {
		return Network_GetLayerByIndex($this->_cPtr,$index);
	}

	function GetLayerByName($layer_name) {
		return Network_GetLayerByName($this->_cPtr,$layer_name);
	}

	function TestCapability($cap) {
		return Network_TestCapability($this->_cPtr,$cap);
	}

	function StartTransaction($force=null) {
		switch (func_num_args()) {
		case 0: $r=Network_StartTransaction($this->_cPtr); break;
		default: $r=Network_StartTransaction($this->_cPtr,$force);
		}
		return $r;
	}

	function CommitTransaction() {
		return Network_CommitTransaction($this->_cPtr);
	}

	function RollbackTransaction() {
		return Network_RollbackTransaction($this->_cPtr);
	}
}

class GenericNetwork extends Network {
	public $_cPtr=null;

	function __set($var,$value) {
		if ($var === 'thisown') return swig_gnm_alter_newobject($this->_cPtr,$value);
		Network::__set($var,$value);
	}

	function __isset($var) {
		if ($var === 'thisown') return true;
		return Network::__isset($var);
	}

	function __get($var) {
		if ($var === 'thisown') return swig_gnm_get_newobject($this->_cPtr);
		return Network::__get($var);
	}
	function __construct($h) {
		$this->_cPtr=$h;
	}

	function ConnectFeatures($nSrcFID,$nTgtFID,$nConFID,$dfCost,$dfInvCost,$eDir) {
		return GenericNetwork_ConnectFeatures($this->_cPtr,$nSrcFID,$nTgtFID,$nConFID,$dfCost,$dfInvCost,$eDir);
	}

	function DisconnectFeatures($nSrcFID,$nTgtFID,$nConFID) {
		return GenericNetwork_DisconnectFeatures($this->_cPtr,$nSrcFID,$nTgtFID,$nConFID);
	}

	function DisconnectFeaturesWithId($nFID) {
		return GenericNetwork_DisconnectFeaturesWithId($this->_cPtr,$nFID);
	}

	function ReconnectFeatures($nSrcFID,$nTgtFID,$nConFID,$dfCost,$dfInvCost,$eDir) {
		return GenericNetwork_ReconnectFeatures($this->_cPtr,$nSrcFID,$nTgtFID,$nConFID,$dfCost,$dfInvCost,$eDir);
	}

	function CreateRule($pszRuleStr) {
		return GenericNetwork_CreateRule($this->_cPtr,$pszRuleStr);
	}

	function DeleteAllRules() {
		return GenericNetwork_DeleteAllRules($this->_cPtr);
	}

	function DeleteRule($pszRuleStr) {
		return GenericNetwork_DeleteRule($this->_cPtr,$pszRuleStr);
	}

	function GetRules() {
		return GenericNetwork_GetRules($this->_cPtr);
	}

	function ConnectPointsByLines($papszLayerList,$dfTolerance,$dfCost,$dfInvCost,$eDir) {
		return GenericNetwork_ConnectPointsByLines($this->_cPtr,$papszLayerList,$dfTolerance,$dfCost,$dfInvCost,$eDir);
	}

	function ChangeBlockState($nFID,$bIsBlock) {
		return GenericNetwork_ChangeBlockState($this->_cPtr,$nFID,$bIsBlock);
	}

	function ChangeAllBlockState($bIsBlock=false) {
		return GenericNetwork_ChangeAllBlockState($this->_cPtr,$bIsBlock);
	}
}


?>
